Fully builds...

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2023-01-20 15:14:20 -08:00
parent 9074526172
commit 1a48f0eae6
7 changed files with 23 additions and 19 deletions

View File

@ -6,10 +6,11 @@
!*.sh
!*.md
!config
config/local.json
!client
client/node_modules
!frontend
frontend/bower_modules
frontend/bower_components
!server
server/node_modules
!scanner

View File

@ -30,17 +30,17 @@ RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
git
WORKDIR /website
COPY /*.json /website/
RUN npm upgrade && npm install
COPY /package.json /website/
RUN npm install
COPY /.babelrc /*.html /*.js /website/
COPY /src /website/src
COPY /frontend /website/frontend
RUN cat package.json
RUN npm run build
WORKDIR /website/client
COPY /client/*.json /website/client/
RUN npm upgrade && npm install
COPY /client/package.json /website/client/
RUN npm install
COPY /client/tsconfig.json /website/client/
COPY /client/*.js /website/client/
COPY /client/public /website/client/public
COPY /client/src /website/client/src
@ -77,10 +77,16 @@ RUN pip install piexif
# install <1.24
RUN pip install "numpy<1.24"
COPY /server /website/server
WORKDIR /website/server
COPY /server/package.json /website/server/
RUN npm install
COPY /config /website/config
COPY /server/*.js /website/server/
COPY /server/db /website/server/db
COPY /server/routes /website/server/routes
COPY /server/lib /website/server/lib
# Copy the Python face management scripts
COPY /ketrface /website/ketrface
@ -88,7 +94,7 @@ COPY /ketrface /website/ketrface
# 'website' is used if DEVELOPMENT is not set (PRODUCTION)
#
FROM runtime AS website
RUN "Building PRODUCTION"
RUN echo "Building PRODUCTION"
COPY /server/production.location /etc/nginx/snippets/active.location
COPY --from=production /website/dist /website/dist
COPY --from=production /website/*.html /website/
@ -112,7 +118,7 @@ COPY /config/default.json /website/config/default.json
# Switch to bash instead of sh
SHELL [ "/bin/bash", "-c" ]
RUN cp /website/server/nginx.conf /etc/nginx/sites-enabled/default
COPY /server/nginx.conf /etc/nginx/sites-enabled/default
COPY /scripts /opt/scripts
ENV PATH="${PATH}:/opt/scripts"

View File

@ -1,6 +1,6 @@
#!/bin/bash
pid=$(ps aux |
grep -E '[0-9] (/usr/bin/)?node .*server/app.js' |
grep -E '[0-9] (/usr/bin/)?node app.js' |
while read user pid rest; do
echo $pid;
done)

View File

@ -41,8 +41,8 @@ app.set("trust proxy", true);
app.use(basePath, require("./routes/basepath.js"));
/* Handle static files first so excessive logging doesn't occur */
app.use(basePath, express.static("frontend", { index: false }));
app.use(basePath + "dist", express.static("dist", { index: false }));
app.use(basePath, express.static("../frontend", { index: false }));
app.use(basePath + "dist", express.static("../dist", { index: false }));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({

View File

@ -4,11 +4,8 @@
"description": "Self hosting photo",
"main": "server/app.js",
"scripts": {
"start": "node app.js",
"start-devel": "concurrently \"npm:server\" \"npm:dev\"",
"server": "node ./app.js",
"debug": "node --inspect --debug-brk ./app.js",
"backend": "NODE_CONFIG_ENV='production' node app.js"
"start": "NODE_CONFIG_DIR=../config node app.js",
"debug": "node --inspect --debug-brk ./app.js"
},
"repository": {
"type": "git",

View File

@ -20,7 +20,7 @@ router.get("/*", function(req, res, next) {
/* Replace <script>'<base href="/BASEPATH/">';</script> in index.html with
* the basePath */
fs.readFile("frontend" + parts.pathname, "utf8", function(error, content) {
fs.readFile("../frontend" + parts.pathname, "utf8", function(error, content) {
if (error) {
return next();
}

View File

@ -51,7 +51,7 @@ router.get("/*", function(req, res, next) {
console.log(JSON.stringify(parts, null, 2));
switch (parts.pathname) {
case "/":
source = "frontend/index.html";
source = "../frontend/index.html";
break;
case "/identities":
source = "./index.html";