-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (32 loc) · 853 Bytes
/
Dockerfile
File metadata and controls
40 lines (32 loc) · 853 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
# Build stage for frontend
FROM node:20-alpine AS frontend-build
WORKDIR /app
COPY frontend/package*.json frontend/
COPY frontend/.npmrc frontend/
WORKDIR /app/frontend
RUN npm ci --legacy-peer-deps
COPY frontend/ .
RUN npm run build
# Build stage for backend
FROM node:20-alpine AS backend-build
WORKDIR /app
COPY backend/package*.json backend/
COPY backend/.npmrc backend/
WORKDIR /app/backend
RUN npm ci
# Production stage
FROM node:20-alpine
WORKDIR /app
# Copy package files
COPY package.json .
COPY .npmrc* .
# Copy backend
COPY backend/ backend/
COPY --from=backend-build /app/backend/node_modules backend/node_modules
# Copy frontend build
COPY --from=frontend-build /app/frontend/build frontend/build
# Create necessary directories
RUN mkdir -p backend/uploads/games
ENV NODE_ENV=production
EXPOSE 5000
CMD ["node", "backend/server.js"]