Building with updated packages

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2022-12-31 20:24:50 -08:00
parent a10bc47d75
commit 89cd61492d
17 changed files with 51 additions and 336 deletions

View File

@ -6,7 +6,6 @@
!entrypoint.sh !entrypoint.sh
!face.js !face.js
!frontend !frontend
!models
!package.json !package.json
!package-lock.json !package-lock.json
!password.js !password.js

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
config/local.json config/local.json
models
node_modules node_modules
./elements ./elements
frontend/bower_components frontend/bower_components

View File

@ -1,58 +1,43 @@
FROM ubuntu:eoan FROM ubuntu:jammy
RUN apt-get update RUN apt-get update \
&& DEBIAN_FRONTEND=NONINTERACTIVE apt-get upgrade -y
RUN apt-get install -y wget RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
wget \
pip \
libgl1 \
libglib2.0-0 \
nginx \
rsync \
less \
git \
sqlite3
# Upgrade Node # Upgrade Node
RUN wget -qO- https://deb.nodesource.com/setup_10.x | bash - RUN wget -qO- https://deb.nodesource.com/setup_18.x | bash -
RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
nodejs \
gcc \
g++ \
make \
cmake
# You can then install the latest npm and npx RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
nodejs
# Install the latest npm and npx
RUN npm install --global npm@latest RUN npm install --global npm@latest
# Speed up face-recognition and dev tools # Install deepface and retina-face
RUN apt-get install -y libopenblas-dev RUN pip install deepface
RUN pip install retina-face
# Required for dlib to build # numpy 1.24 deprecated float; deepface is still using it, so we need to
RUN apt-get install -y libx11-dev libpng16-16 # install <1.24
RUN pip install "numpy<1.24"
# NEF processing uses darktable-cli, provided via darktable RUN apt-get install -y python2
RUN apt-get install -y darktable
# Create a user with sudo access COPY /entrypoint.sh /
RUN DEBIAN_FRONTEND=noninteractive \
&& apt-get install --no-install-recommends -y \
sudo
# NOTE: Requires 'sudo' package to already be installed
RUN groupadd -g 1000 user \
&& useradd --no-log-init \
-s /bin/bash \
-u 1000 \
-m \
-g user \
-G sudo \
-p $(echo "user" | openssl passwd -stdin) user
# Set 'sudo' to NOPASSWD for all container users
RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers
RUN DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
git \
sqlite3
COPY . /website COPY . /website
#USER user
WORKDIR /website WORKDIR /website
RUN npm install RUN npm upgrade && npm install
CMD [ "/website/entrypoint.sh" ] CMD [ "/entrypoint.sh" ]

View File

@ -1,113 +0,0 @@
<html>
<script>'<base href="BASEPATH">';</script>
<script>
function loadMore(index) {
var clusterBlock = document.body.querySelector("[cluster-index='" + index + "']");
if (!clusterBlock) {
return;
}
var faces = clusterBlock.querySelectorAll("div.face").length, i
for (i = faces; i < clusters[index].length; i++) {
if (i - faces > 10) {
return;
}
var tuple = clusters[index][i],
face = createFace(tuple[0], tuple[1]);
clusterBlock.appendChild(face);
}
if (i == clusters[index].length) {
var span = clusterBlock.querySelector("span.more");
if (span) {
span.parentElement.removeChild(span);
}
}
}
function createFace(faceId, photoId) {
var div = document.createElement("div");
div.classList.add("face");
div.setAttribute("photo-id", photoId);
div.style.backgroundImage = "url(face-data/" + (faceId % 100) + "/" + faceId + "-original.png)";
div.addEventListener("click", (event) => {
let photoId = parseInt(event.currentTarget.getAttribute("photo-id"));
if (photoId) {
window.open("face-explorer.html?" + photoId, "photo-" + photoId);
} else {
alert("No photo id mapped to face.");
}
});
return div;
}
function shuffle(array) {
var i = array.length, tmp, random;
while (i > 0) {
random = Math.floor(Math.random() * i);
i--;
tmp = array[i];
array[i] = array[random];
array[random] = tmp;
}
return array;
}
document.addEventListener("DOMContentLoaded", (event) => {
var div = document.createElement("div");
div.textContent = "There are " + clusters.length + " clusters.";
document.body.appendChild(div);
clusters.sort((a, b) => { return b.length - a.length });
clusters.forEach((cluster, clusterIndex) => {
var clusterBlock = document.createElement("div");
clusterBlock.setAttribute("cluster-index", clusterIndex);
document.body.appendChild(clusterBlock);
var div = document.createElement("div");
var html = "Cluster " + (clusterIndex + 1) + " has " + cluster.length + " neighbors.";
if (cluster.length > 10) {
html += " <span class='more' onClick='loadMore(" + clusterIndex + ")'>more</a>";
}
div.innerHTML = html;
clusterBlock.appendChild(div);
shuffle(cluster);
cluster.forEach((tuple, index) => {
if (index >= 10) {
return;
}
var face = createFace(tuple[0], tuple[1]);
clusterBlock.appendChild(face);
});
});
});
</script>
<style>
body {
margin: 0;
padding: 0;
}
.more {
cursor: pointer;
}
.more:hover {
text-decoration: underline;
}
.face {
width: 128px;
height: 128px;
background-size: contain;
background-position: center center;
display: inline-block;
border: 1px solid black;
margin: 0.5em;
cursor: pointer;
}
.face:hover {
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.5);
}
</style>

View File

@ -25,6 +25,7 @@
}, },
"picturesPath": "./pictures", "picturesPath": "./pictures",
"basePath": "/photos", "basePath": "/photos",
"faceData": "./pictures/face-data",
"sessions": { "sessions": {
"db": "sessions.db", "db": "sessions.db",
"store-secret": "234j23jffj23f!41$@#!1113j3" "store-secret": "234j23jffj23f!41$@#!1113j3"

View File

@ -15,16 +15,16 @@ services:
# - ./init.sql:/data/application/init.sql # - ./init.sql:/data/application/init.sql
photos: photos:
user: ${USER_ID}
build: . build: .
image: photos:latest image: photos:latest
container_name: photos container_name: dad-photos
# depends_on: # depends_on:
# - db # - db
restart: always restart: always
ports: ports:
- 8123:8123 - 8134:8123
volumes: volumes:
- ${PWD}/photos:/photos - ${PWD}/pictures:/photos
- ${PWD}/db:/db - ${PWD}/db:/db
- ${PWD}:/website - ${PWD}:/website
- ${PWD}/models:/root/.deepface

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -26,63 +26,48 @@
"face-recognition": "^0.9.4" "face-recognition": "^0.9.4"
}, },
"dependencies": { "dependencies": {
"@tensorflow/tfjs-core": "^1.5.2",
"@tensorflow/tfjs-node": "^1.5.2",
"animakit-expander": "^2.1.4",
"bluebird": "^3.7.2", "bluebird": "^3.7.2",
"body-parser": "^1.19.0", "body-parser": "^1.20.1",
"bootstrap": "^4.4.1", "bootstrap": "^4.4.1",
"canvas": "^2.6.1",
"concurrently": "^5.1.0", "concurrently": "^5.1.0",
"config": "^3.2.4", "config": "^3.3.8",
"connect-sqlite3": "^0.9.11",
"cookie-parser": "^1.4.4", "cookie-parser": "^1.4.4",
"core-js": "^3.2.1", "core-js": "^3.2.1",
"exif-reader": "github:paras20xx/exif-reader", "exif-reader": "github:paras20xx/exif-reader",
"express": "^4.17.1", "express": "^4.18.2",
"express-session": "^1.17.0", "express-session": "^1.17.0",
"face-api.js": "^0.22.0", "face-api.js": "^0.22.0",
"googleapis": "^40.0.0", "googleapis": "^110.0.0",
"handlebars": "^4.7.2", "handlebars": "^4.7.7",
"jira-connector": "^2.10.0",
"ldapauth-fork": "=4.2.0", "ldapauth-fork": "=4.2.0",
"ldapjs": "^1.0.2", "ldapjs": "^1.0.2",
"mariasql": "^0.2.6", "moment": "^2.29.4",
"moment": "^2.24.0",
"moment-holiday": "^1.5.1", "moment-holiday": "^1.5.1",
"morgan": "^1.9.1", "morgan": "^1.9.1",
"mustache": "^3.2.1", "mustache": "^3.2.1",
"node-fetch": "^2.6.0", "node-fetch": "^2.6.7",
"node-gzip": "^1.1.2", "node-gzip": "^1.1.2",
"nodemailer": "^6.3.0", "nodemailer": "^6.8.0",
"qs": "^6.9.1", "react-app-polyfill": "^3.0.0",
"react-app-polyfill": "^1.0.2",
"react-bootstrap": "^1.0.0-beta.16", "react-bootstrap": "^1.0.0-beta.16",
"react-date-range": "^1.0.0-beta", "react-date-range": "^1.0.0-beta",
"react-markdown": "^4.2.2",
"react-router-dom": "^5.0.1", "react-router-dom": "^5.0.1",
"react-scroll": "^1.7.14", "sequelize": "^6.0"
"react-syntax-highlighter": "^11.0.2",
"sequelize": "^5.21.3",
"sequelize-mysql": "^1.7.0",
"sharp": "^0.20.8",
"sqlite3": "^4.1.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.1.0", "@babel/cli": "^7.20.7",
"@babel/core": "^7.1.0", "@babel/core": "^7.1.0",
"@babel/plugin-proposal-class-properties": "^7.4.4", "@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.1.0", "@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0", "@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.2", "babel-loader": "^9.1.0",
"css-loader": "^1.0.0", "css-loader": "^6.7.3",
"file-loader": "^4.1.0",
"react": "^16.8", "react": "^16.8",
"react-dom": "^16.8", "react-dom": "^16.8",
"style-loader": "^0.23.0", "style-loader": "^0.23.0",
"webpack": "^4.19.1", "webpack": "^5.75.0",
"webpack-cli": "^3.1.1", "webpack-cli": "^5.0.1",
"webpack-dev-server": "^3.3.1", "webpack-dev-server": "^4.11.1",
"webpack-merge": "^4.2.1" "webpack-merge": "^4.2.1"
}, },
"jshintConfig": { "jshintConfig": {