fix: all docker issues

This commit is contained in:
Artemy Egorov 2023-08-28 22:15:13 +03:00
parent dcf6e565c2
commit 5ac36f9681
4 changed files with 8 additions and 7 deletions

View File

@ -6,7 +6,7 @@ RUN npm run build
FROM node:18-alpine as run
WORKDIR /app
COPY /app/dist /app/package*.json . --from=build
COPY --from=build /app/dist/ /app/package*.json ./
RUN npm install --omit=dev
CMD npm start
CMD npm run start:docker
EXPOSE 8080

View File

@ -2,11 +2,11 @@ version: "3"
services:
txtdot:
image: darkcat09/txtdot:latest
build: .
ports:
- "8080:8080"
restart: unless-stopped
network_mode: host
environment:
- HOST=127.0.0.1
- HOST=0.0.0.0
- PORT=8080
- REVERSE_PROXY=true
# env_file: .env

View File

@ -35,6 +35,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npm run clean-css && copyfiles ./templates/*.ejs .env ./dist/ && tsc",
"start": "cd ./dist && node ./src/app.js",
"start:docker": "node ./src/app.js",
"clean-css": "cleancss --batch static/*.css -o dist/static --batch-suffix \"\"",
"dev": "tsc-watch --onSuccess \"node ./dist/src/app.js\""
},

View File

@ -8,7 +8,7 @@ export class ConfigService {
constructor() {
config();
this.host = process.env.HOST || "localhost";
this.host = process.env.HOST || "0.0.0.0";
this.port = Number(process.env.PORT) || 8080;
this.reverse_proxy = Boolean(process.env.REVERSE_PROXY) || false;