Update submodules with upstream Dockerization PRs

This commit is contained in:
Matthew Lopez
2024-07-22 22:42:16 -04:00
parent d4ebfc31ff
commit c63162eb28
25 changed files with 126 additions and 464 deletions

View File

@@ -280,7 +280,7 @@ services:
target: /app/logs/
- type: bind
source: ./config/website-config.json
target: /app/config.json
target: /home/node/app/config.json
read_only: true
networks:
internal:

View File

@@ -9,6 +9,7 @@ module.exports = JSON.parse(
server_environment: process.env.JUXT_CONFIG_SERVER_ENVIRONMENT,
mongoose: {
uri: process.env.JUXT_CONFIG_MONGODB_URI,
database: process.env.JUXT_CONFIG_MONGODB_DATABASE,
options: {
useNewUrlParser: true,
useUnifiedTopology: true,

View File

@@ -1,5 +1,6 @@
JUXT_CONFIG_HTTP_PORT=8080
JUXT_CONFIG_MONGODB_URI=mongodb://mongodb:27017/pretendo_miiverse?replicaSet=rs
JUXT_CONFIG_MONGODB_URI=mongodb://mongodb:27017
JUXT_CONFIG_MONGODB_DATABASE=pretendo_miiverse?replicaSet=rs
JUXT_CONFIG_SERVER_ENVIRONMENT=prod
JUXT_CONFIG_CDN_DOMAIN=
JUXT_CONFIG_MII_IMAGE_CDN=mii.olv.pretendo.cc

View File

@@ -0,0 +1,10 @@
diff --git i/Dockerfile w/Dockerfile
index 53811ab..1a5b1a9 100644
--- i/Dockerfile
+++ w/Dockerfile
@@ -44,4 +44,4 @@ COPY package.json .
COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules
COPY --from=build ${app_dir}/dist ${app_dir}/dist
-CMD ["node", "."]
+CMD ["node", "--inspect=0.0.0.0:9233", "."]

View File

@@ -1,64 +0,0 @@
diff --git c/.dockerignore i/.dockerignore
new file mode 100644
index 0000000..19cdd91
--- /dev/null
+++ i/.dockerignore
@@ -0,0 +1,4 @@
+.git
+node_modules
+dist
+logs
diff --git c/Dockerfile i/Dockerfile
new file mode 100644
index 0000000..25e1b0a
--- /dev/null
+++ i/Dockerfile
@@ -0,0 +1,48 @@
+# syntax=docker/dockerfile:1
+
+ARG app_dir="/home/node/app"
+
+
+# * Base Node.js image
+FROM node:20-alpine AS base
+ARG app_dir
+WORKDIR ${app_dir}
+
+
+# * Installing production dependencies
+FROM base AS dependencies
+
+RUN --mount=type=bind,source=package.json,target=package.json \
+ --mount=type=bind,source=package-lock.json,target=package-lock.json \
+ --mount=type=cache,target=/root/.npm \
+ npm ci --omit=dev
+
+
+# * Installing development dependencies and building the application
+FROM base AS build
+
+RUN --mount=type=bind,source=package.json,target=package.json \
+ --mount=type=bind,source=package-lock.json,target=package-lock.json \
+ --mount=type=cache,target=/root/.npm \
+ npm ci
+
+COPY . .
+RUN npm run build
+
+
+# * Running the final application
+FROM base AS final
+ARG app_dir
+
+RUN mkdir -p ${app_dir}/logs
+RUN chown node:node ${app_dir}/logs
+
+ENV NODE_ENV production
+USER node
+
+COPY package.json .
+
+COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules
+COPY --from=build ${app_dir}/dist ${app_dir}/dist
+
+CMD ["node", "."]

View File

@@ -1,12 +0,0 @@
diff --git i/src/server.ts w/src/server.ts
index 5db5542..f4c1d47 100644
--- i/src/server.ts
+++ w/src/server.ts
@@ -1,4 +1,7 @@
process.title = 'Pretendo - BOSS';
+process.on('SIGTERM', () => {
+ process.exit(0);
+});
import express from 'express';
import morgan from 'morgan';

View File

@@ -1,23 +0,0 @@
diff --git i/src/config-manager.ts w/src/config-manager.ts
index b027e54..fa5284e 100644
--- i/src/config-manager.ts
+++ w/src/config-manager.ts
@@ -83,15 +83,15 @@ if (!config.http.port) {
}
if (md5(config.crypto.wup.aes_key) !== BOSS_WIIU_AES_KEY_MD5_HASH) {
- errors.push('Invalid BOSS WiiU AES key. Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY environment variable');
+ warnings.push('Invalid BOSS WiiU AES key. Uploading and encrypting files won\'t work! Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY environment variable');
}
if (md5(config.crypto.wup.hmac_key) !== BOSS_WIIU_HMAC_KEY_MD5_HASH) {
- errors.push('Invalid BOSS WiiU HMAC key. Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY environment variable');
+ warnings.push('Invalid BOSS WiiU HMAC key. Uploading and encrypting files won\'t work! Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY environment variable');
}
if (md5(config.crypto.ctr.aes_key) !== BOSS_3DS_AES_KEY_MD5_HASH) {
- errors.push('Invalid BOSS 3DS AES key. Set or correct the PN_BOSS_CONFIG_BOSS_3DS_AES_KEY environment variable');
+ warnings.push('Invalid BOSS 3DS AES key. Set or correct the PN_BOSS_CONFIG_BOSS_3DS_AES_KEY environment variable');
}
if (!config.grpc.boss.address) {

View File

@@ -1,130 +0,0 @@
diff --git i/package-lock.json w/package-lock.json
index f72209d..00d6594 100644
--- i/package-lock.json
+++ w/package-lock.json
@@ -20,6 +20,7 @@
"dotenv": "^10.0.0",
"express": "^4.17.1",
"express-subdomain": "^1.0.5",
+ "fs-extra": "^11.2.0",
"moment": "^2.29.4",
"mongoose": "^7.4.3",
"morgan": "^1.10.0",
@@ -36,7 +37,6 @@
"@typescript-eslint/parser": "^6.4.0",
"axios": "^1.6.2",
"eslint": "^8.47.0",
- "fs-extra": "^10.1.0",
"tsc-alias": "^1.8.7",
"typescript": "^5.1.6",
"xmlbuilder2": "^3.0.2"
@@ -3458,17 +3458,16 @@
}
},
"node_modules/fs-extra": {
- "version": "10.1.0",
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
- "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
- "dev": true,
+ "version": "11.2.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
+ "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
- "node": ">=12"
+ "node": ">=14.14"
}
},
"node_modules/fs-minipass": {
@@ -3599,8 +3598,7 @@
"node_modules/graceful-fs": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
- "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
- "dev": true
+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg=="
},
"node_modules/graphemer": {
"version": "1.4.0",
@@ -3855,7 +3853,6 @@
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
- "dev": true,
"dependencies": {
"universalify": "^2.0.0"
},
@@ -5211,7 +5208,6 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
- "dev": true,
"engines": {
"node": ">= 10.0.0"
}
@@ -8071,10 +8067,9 @@
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="
},
"fs-extra": {
- "version": "10.1.0",
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
- "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
- "dev": true,
+ "version": "11.2.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
+ "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
@@ -8172,8 +8167,7 @@
"graceful-fs": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
- "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
- "dev": true
+ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg=="
},
"graphemer": {
"version": "1.4.0",
@@ -8357,7 +8351,6 @@
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
- "dev": true,
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
@@ -9317,8 +9310,7 @@
"universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
- "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
- "dev": true
+ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
},
"unpipe": {
"version": "1.0.0",
diff --git i/package.json w/package.json
index 0e95ff9..24a694b 100644
--- i/package.json
+++ w/package.json
@@ -24,6 +24,7 @@
"dotenv": "^10.0.0",
"express": "^4.17.1",
"express-subdomain": "^1.0.5",
+ "fs-extra": "^11.2.0",
"moment": "^2.29.4",
"mongoose": "^7.4.3",
"morgan": "^1.10.0",
@@ -40,7 +41,6 @@
"@typescript-eslint/parser": "^6.4.0",
"axios": "^1.6.2",
"eslint": "^8.47.0",
- "fs-extra": "^10.1.0",
"tsc-alias": "^1.8.7",
"typescript": "^5.1.6",
"xmlbuilder2": "^3.0.2"

View File

@@ -0,0 +1,10 @@
diff --git i/Dockerfile w/Dockerfile
index 53811ab..a141e8c 100644
--- i/Dockerfile
+++ w/Dockerfile
@@ -44,4 +44,4 @@ COPY package.json .
COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules
COPY --from=build ${app_dir}/dist ${app_dir}/dist
-CMD ["node", "."]
+CMD ["node", "--inspect=0.0.0.0:9229", "."]

View File

@@ -0,0 +1,10 @@
diff --git i/Dockerfile w/Dockerfile
index 7f2cada..b989512 100644
--- i/Dockerfile
+++ w/Dockerfile
@@ -49,4 +49,4 @@ COPY --from=build ${app_dir} ${app_dir}
# TODO: change back after TypeScript migration
#COPY --from=build ${app_dir}/dist ${app_dir}/dist
-CMD ["node", "."]
+CMD ["node", "--inspect=0.0.0.0:9232", "."]

View File

@@ -1,27 +0,0 @@
diff --git i/Dockerfile w/Dockerfile
index be1b7af..9340a30 100644
--- i/Dockerfile
+++ w/Dockerfile
@@ -1,15 +1,17 @@
-FROM node:18-alpine
+# https://github.com/nodejs/docker-node/issues/2009
+FROM node:18-alpine3.18
-RUN apk add --no-cache python3 make gcc g++
WORKDIR /app
COPY "docker/entrypoint.sh" ./
COPY package*.json ./
+# For the config.js hack
+RUN npm install module-alias
RUN npm install
COPY . ./
+# There is an npm run build task in the package.json, and it runs tsc, but there
+# is no TypeScript at all in the source code. Weird.
-VOLUME [ "/app/config.json", "/app/certs" ]
-
-CMD ["sh", "entrypoint.sh"]
+CMD ["node", "--inspect=0.0.0.0:9232", "./src/server.js"]

View File

@@ -1,23 +0,0 @@
diff --git i/src/server.js w/src/server.js
index be65907..ff45025 100644
--- i/src/server.js
+++ w/src/server.js
@@ -1,6 +1,11 @@
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable @typescript-eslint/no-var-requires */
+require('module-alias/register');
process.title = 'Pretendo - Juxt-Web';
+process.on('SIGTERM', () => {
+ process.exit(0);
+});
+
const express = require('express');
const morgan = require('morgan');
const cookieParser = require('cookie-parser');
@@ -88,4 +93,4 @@ async function main() {
});
}
-main().catch(console.error);
\ No newline at end of file
+main().catch(console.error);

View File

@@ -1,21 +0,0 @@
diff --git i/src/database.js w/src/database.js
index ebdd39a..21a4b77 100644
--- i/src/database.js
+++ w/src/database.js
@@ -9,14 +9,14 @@ const { POST } = require('./models/post');
const { SETTINGS } = require('./models/settings');
const { REPORT } = require('./models/report');
-const { uri, database, options } = mongooseConfig;
+const { uri, options } = mongooseConfig;
const logger = require('./logger');
let connection;
mongoose.set('strictQuery', true);
async function connect() {
- await mongoose.connect(`${uri}/${database}`, options);
+ await mongoose.connect(`${uri}`, options);
connection = mongoose.connection;
connection.on('connected', function () {
logger.info(`MongoDB connected ${this.name}`);

View File

@@ -1,13 +0,0 @@
diff --git i/src/redisCache.js w/src/redisCache.js
index b4f3b7a..cabe595 100644
--- i/src/redisCache.js
+++ w/src/redisCache.js
@@ -5,7 +5,7 @@ const logger = require('./logger');
const config = require('../config.json');
const { host, port } = config.redis;
-const redisClient = redis.createClient({ host, port });
+const redisClient = redis.createClient({ url: `redis://${host}:${port}` });
redisClient.on('error', (error) => {
logger.error(error);

View File

@@ -1,20 +1,75 @@
diff --git i/package-lock.json w/package-lock.json
index f2dc7fd..01d5ade 100644
--- i/package-lock.json
+++ w/package-lock.json
@@ -24,6 +24,7 @@
"hashmap": "^2.4.0",
"image-pixels": "^1.1.1",
"memory-cache": "^0.2.0",
+ "module-alias": "^2.2.3",
"moment": "^2.29.1",
"mongoose": "^6.0.13",
"mongoose-fuzzy-search-next": "^1.0.13",
@@ -5249,6 +5250,11 @@
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
+ "node_modules/module-alias": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.3.tgz",
+ "integrity": "sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q=="
+ },
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
@@ -11132,6 +11138,11 @@
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
+ "module-alias": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.3.tgz",
+ "integrity": "sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q=="
+ },
"moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
diff --git i/package.json w/package.json
index 5132be7..177de10 100644
index 5132be7..3568117 100644
--- i/package.json
+++ w/package.json
@@ -64,5 +64,14 @@
@@ -36,6 +36,7 @@
"hashmap": "^2.4.0",
"image-pixels": "^1.1.1",
"memory-cache": "^0.2.0",
+ "module-alias": "^2.2.3",
"moment": "^2.29.1",
"mongoose": "^6.0.13",
"mongoose-fuzzy-search-next": "^1.0.13",
@@ -64,5 +65,14 @@
"request": "^2.88.2",
"tsc-alias": "^1.8.6",
"typescript": "^5.1.3"
- }
+ },
+ "_moduleAliases": {
+ "config.json": "/app/config.js",
+ "../config.json": "/app/config.js",
+ "../../config.json": "/app/config.js",
+ "../../../config.json": "/app/config.js",
+ "../../../../config.json": "/app/config.js",
+ "../../../../../config.json": "/app/config.js",
+ "../../../../../../config.json": "/app/config.js"
+ }
+ },
+ "_moduleAliases": {
+ "config.json": "/app/config.js",
+ "../config.json": "/app/config.js",
+ "../../config.json": "/app/config.js",
+ "../../../config.json": "/app/config.js",
+ "../../../../config.json": "/app/config.js",
+ "../../../../../config.json": "/app/config.js",
+ "../../../../../../config.json": "/app/config.js"
}
}
diff --git i/src/server.js w/src/server.js
index eb628fb..73f24af 100644
--- i/src/server.js
+++ w/src/server.js
@@ -1,5 +1,7 @@
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable @typescript-eslint/no-var-requires */
+require('module-alias/register');
+
process.title = 'Pretendo - Juxt-Web';
process.on('SIGTERM', () => {
process.exit(0);

View File

@@ -0,0 +1,10 @@
diff --git i/Dockerfile w/Dockerfile
index 53811ab..a56b582 100644
--- i/Dockerfile
+++ w/Dockerfile
@@ -44,4 +44,4 @@ COPY package.json .
COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules
COPY --from=build ${app_dir}/dist ${app_dir}/dist
-CMD ["node", "."]
+CMD ["node", "--inspect=0.0.0.0:9231", "."]

View File

@@ -1,75 +0,0 @@
diff --git i/.dockerignore w/.dockerignore
index b4bb16e..19cdd91 100644
--- i/.dockerignore
+++ w/.dockerignore
@@ -1,5 +1,4 @@
-node_modules
.git
-config.json
-certs
-src/logs
+node_modules
+dist
+logs
diff --git i/Dockerfile w/Dockerfile
index be1b7af..25e1b0a 100644
--- i/Dockerfile
+++ w/Dockerfile
@@ -1,15 +1,48 @@
-FROM node:18-alpine
+# syntax=docker/dockerfile:1
-RUN apk add --no-cache python3 make gcc g++
-WORKDIR /app
+ARG app_dir="/home/node/app"
-COPY "docker/entrypoint.sh" ./
-COPY package*.json ./
-RUN npm install
+# * Base Node.js image
+FROM node:20-alpine AS base
+ARG app_dir
+WORKDIR ${app_dir}
-COPY . ./
-VOLUME [ "/app/config.json", "/app/certs" ]
+# * Installing production dependencies
+FROM base AS dependencies
-CMD ["sh", "entrypoint.sh"]
+RUN --mount=type=bind,source=package.json,target=package.json \
+ --mount=type=bind,source=package-lock.json,target=package-lock.json \
+ --mount=type=cache,target=/root/.npm \
+ npm ci --omit=dev
+
+
+# * Installing development dependencies and building the application
+FROM base AS build
+
+RUN --mount=type=bind,source=package.json,target=package.json \
+ --mount=type=bind,source=package-lock.json,target=package-lock.json \
+ --mount=type=cache,target=/root/.npm \
+ npm ci
+
+COPY . .
+RUN npm run build
+
+
+# * Running the final application
+FROM base AS final
+ARG app_dir
+
+RUN mkdir -p ${app_dir}/logs
+RUN chown node:node ${app_dir}/logs
+
+ENV NODE_ENV production
+USER node
+
+COPY package.json .
+
+COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules
+COPY --from=build ${app_dir}/dist ${app_dir}/dist
+
+CMD ["node", "."]

View File

@@ -1,19 +0,0 @@
diff --git i/src/server.ts w/src/server.ts
index bc34398..46d42c7 100644
--- i/src/server.ts
+++ w/src/server.ts
@@ -1,4 +1,7 @@
process.title = 'Pretendo - Miiverse';
+process.on('SIGTERM', () => {
+ process.exit(0);
+});
import express from 'express';
import morgan from 'morgan';
@@ -78,4 +81,4 @@ async function main(): Promise<void> {
});
}
-main().catch(console.error);
\ No newline at end of file
+main().catch(console.error);

View File

@@ -0,0 +1,10 @@
diff --git i/Dockerfile w/Dockerfile
index b72d258..03e2025 100644
--- i/Dockerfile
+++ w/Dockerfile
@@ -48,4 +48,4 @@ COPY --from=build ${app_dir} ${app_dir}
# TODO: change back after TypeScript migration
#COPY --from=build ${app_dir}/dist ${app_dir}/dist
-CMD ["node", "."]
+CMD ["node", "--inspect=0.0.0.0:9230", "."]

View File

@@ -1,26 +0,0 @@
diff --git c/.dockerignore i/.dockerignore
new file mode 100644
index 0000000..dd2040f
--- /dev/null
+++ i/.dockerignore
@@ -0,0 +1,3 @@
+.git
+node_modules
+logs
diff --git c/Dockerfile i/Dockerfile
new file mode 100644
index 0000000..233a823
--- /dev/null
+++ i/Dockerfile
@@ -0,0 +1,11 @@
+FROM node:18-alpine
+
+WORKDIR /app
+
+COPY package*.json .
+RUN npm install
+
+COPY . .
+RUN npm run build
+
+CMD ["node", "--inspect=0.0.0.0:9230", "./src/server.js"]

View File

@@ -1,12 +0,0 @@
diff --git i/src/server.js w/src/server.js
index b73bdde..04c714b 100644
--- i/src/server.js
+++ w/src/server.js
@@ -1,4 +1,7 @@
process.title = 'Pretendo - Website';
+process.on('SIGTERM', () => {
+ process.exit(0);
+});
const express = require('express');
const handlebars = require('express-handlebars');