feat: Docker, docker-compose, and deployment config (Task 13)
- Dockerfile: two-stage build (builder installs all deps + vite build; runtime copies dist + server) - docker-compose.yml: 127.0.0.1:3004:8080, named volume for SQLite, env var interpolation - .env.example: all required environment variables documented - .dockerignore: exclude node_modules, dist, data, .env from build context - vite.config.ts: outDir → ../client/dist, /api proxy to :3001 for dev - .gitignore: remove Docker entries (files should be tracked for deployment) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
# --- Build stage ---
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache python3 make g++
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm install --no-audit --no-fund
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# --- Runtime stage ---
|
||||
FROM node:20-alpine
|
||||
ENV NODE_ENV=production PORT=8080
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache python3 make g++
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm install --omit=dev --no-audit --no-fund
|
||||
COPY --from=builder /app/client/dist ./client/dist
|
||||
COPY server/ ./server/
|
||||
RUN mkdir -p /app/data && chown -R node:node /app
|
||||
USER node
|
||||
EXPOSE 8080
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD wget -q --spider http://localhost:8080/ || exit 1
|
||||
CMD ["node", "server/server.js"]
|
||||
Reference in New Issue
Block a user