-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (27 loc) · 1 KB
/
Dockerfile
File metadata and controls
39 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Build stage
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package files
COPY package.json package-lock.json* ./
COPY frontend/package.json frontend/package-lock.json* ./frontend/
# Install all dependencies (root + frontend)
RUN npm ci --prefix . 2>/dev/null || npm install --prefix .
RUN npm ci --prefix frontend 2>/dev/null || npm install --prefix frontend
# Copy source code
COPY . .
# Build frontend (VITE_API_URL comes from frontend/.env.production)
RUN npm run build --prefix frontend
# Build backend
RUN npm run build
# Production stage
FROM node:22-alpine AS runner
WORKDIR /app
# Copy only production backend deps (we only need runtime deps for the server)
COPY package.json package-lock.json* ./
RUN npm ci --omit=dev 2>/dev/null || npm install --omit=dev
# Copy built backend and frontend
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/frontend/dist ./frontend/dist
# API keys are passed at runtime via --env-file (not baked into image)
EXPOSE 3000
CMD ["node", "dist/server.js"]