Add Docker setup with multi-stage build and Compose deploy config
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
.git
|
||||
.gitignore
|
||||
.github
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
*.pem
|
||||
*.key
|
||||
README.md
|
||||
LICENSE
|
||||
docs
|
||||
.idea
|
||||
.vscode
|
||||
*.swp
|
||||
.DS_Store
|
||||
node_modules
|
||||
data
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
docker-compose*.yml
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
# ── Stage 1: Dependencies (mit Compiler für better-sqlite3) ──────────────────
|
||||
FROM node:20.19.2-slim AS deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3 make g++ \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
# ── Stage 2: Runtime ──────────────────────────────────────────────────────────
|
||||
FROM node:20.19.2-slim AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN groupadd --system --gid 1001 nodejs \
|
||||
&& useradd --system --uid 1001 --gid nodejs --no-create-home appuser
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
RUN mkdir -p data && chown -R appuser:nodejs data
|
||||
|
||||
VOLUME ["/app/data"]
|
||||
|
||||
USER appuser
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD node -e "require('http').get('http://localhost:3000/',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
app:
|
||||
image: git.hackner.dev/thomas/jobbi-bewerbung:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- data:/app/data
|
||||
environment:
|
||||
PORT: "3000"
|
||||
|
||||
volumes:
|
||||
data:
|
||||
Reference in New Issue
Block a user