Added Dockerfile

This commit is contained in:
Daniel Heße 2026-08-03 23:35:58 +02:00
parent 192959cd65
commit 4880f695fb
2 changed files with 36 additions and 2 deletions

2
.gitignore vendored
View file

@ -4,5 +4,3 @@ dist/
coverage/
.DS_Store
*.log
.env*
!.env.example

36
Dockerfile Normal file
View file

@ -0,0 +1,36 @@
### `Dockerfile`
```dockerfile
# Multi-Stage Dockerfile for Gothic II Mod Website
FROM node:20-alpine AS builder
WORKDIR /app
# Install dependencies first for better Docker layer caching
COPY package*.json ./
RUN npm ci
# Copy source code and build the production bundle
COPY . .
RUN npm run build
# Production Runner Stage
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
# Install production dependencies only
COPY package*.json ./
RUN npm ci --only=production
# Copy built dist files and default cms data from builder
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/src/data ./src/data
COPY --from=builder /app/cms-data.json ./cms-data.json
EXPOSE 3000
CMD ["node", "dist/server.cjs"]
```