feat: dockerfile multi-stage, compose con traefik per deploy vps
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
data
|
||||||
|
uploads
|
||||||
|
.env
|
||||||
|
.git
|
||||||
|
docs
|
||||||
|
assets-src
|
||||||
|
tests
|
||||||
|
*.md
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
# Stage 1: build
|
||||||
|
FROM node:22-slim AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Stage 2: runtime
|
||||||
|
FROM node:22-slim AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci --omit=dev && npm cache clean --force
|
||||||
|
COPY --from=build /app/dist ./dist
|
||||||
|
COPY scripts ./scripts
|
||||||
|
|
||||||
|
ENV HOST=0.0.0.0 \
|
||||||
|
PORT=4321 \
|
||||||
|
DB_PATH=/app/data/insanitylab.db \
|
||||||
|
UPLOADS_DIR=/app/uploads
|
||||||
|
EXPOSE 4321
|
||||||
|
CMD ["node", "./dist/server/entry.mjs"]
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
services:
|
||||||
|
insanitylab:
|
||||||
|
build: .
|
||||||
|
image: insanitylab-website:latest
|
||||||
|
container_name: insanitylab
|
||||||
|
restart: always
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
- HOST=0.0.0.0
|
||||||
|
- PORT=4321
|
||||||
|
- DB_PATH=/app/data/insanitylab.db
|
||||||
|
- UPLOADS_DIR=/app/uploads
|
||||||
|
volumes:
|
||||||
|
- /opt/docker/insanitylab/data:/app/data
|
||||||
|
- /opt/docker/insanitylab/uploads:/app/uploads
|
||||||
|
labels:
|
||||||
|
- traefik.enable=true
|
||||||
|
- traefik.http.routers.insanitylab.rule=Host(`insanitylab.tielogic.xyz`)
|
||||||
|
- traefik.http.routers.insanitylab.tls=true
|
||||||
|
- traefik.http.routers.insanitylab.entrypoints=websecure
|
||||||
|
- traefik.http.routers.insanitylab.tls.certresolver=mytlschallenge
|
||||||
|
- traefik.http.services.insanitylab.loadbalancer.server.port=4321
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
Reference in New Issue
Block a user