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 !*.sh
!*.md !*.md
!config !config
config/local.json
!client !client
client/node_modules client/node_modules
!frontend !frontend
frontend/bower_modules frontend/bower_components
!server !server
server/node_modules server/node_modules
!scanner !scanner

View File

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

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
pid=$(ps aux | 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 while read user pid rest; do
echo $pid; echo $pid;
done) done)

View File

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

View File

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

View File

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

View File

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