-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (36 loc) · 999 Bytes
/
Dockerfile
File metadata and controls
52 lines (36 loc) · 999 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
51
52
# Build stage
FROM node:22-slim AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY backend/package*.json ./backend/
COPY frontend/package*.json ./frontend/
# Install all dependencies
RUN npm install
RUN cd backend && npm install
RUN cd frontend && npm install
# Copy source code
COPY backend ./backend
COPY frontend ./frontend
# Build backend
RUN cd backend && npm run build
# Build frontend
RUN cd frontend && npm run build
# Production stage
FROM node:22-slim
WORKDIR /app
# Copy package files and install production dependencies
COPY package*.json ./
COPY backend/package*.json ./backend/
RUN cd backend && npm install --omit=dev
# Copy built backend
COPY --from=builder /app/backend/dist ./backend/dist
# Copy built frontend to be served by backend
COPY --from=builder /app/frontend/dist ./frontend/dist
# Copy scripts for migrations
COPY scripts ./scripts
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE 3000
WORKDIR /app/backend
CMD ["node", "dist/index.js"]