File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed
Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change 11# Build stage
2- FROM node:22-slim as build
2+ FROM node:22 AS build
33
44WORKDIR /app
55
6- COPY . .
6+ # Copy only necessary files for build
7+ COPY back/package*.json ./back/
8+ COPY shared ./shared/
79
810WORKDIR /app/back
911
10- # Install build tools for native dependencies
11- RUN apt-get update && apt-get install -y \
12- build-essential \
13- && rm -rf /var/lib/apt/lists/*
12+ RUN npm ci
13+
14+ COPY back ./
1415
15- RUN npm install
1616RUN npm run build
1717
1818# Production stage
1919FROM node:22-slim
2020
2121WORKDIR /app/back
2222
23- # Install only runtime dependencies
24- RUN apt-get update && apt-get install -y git \
25- && rm -rf /var/lib/apt/lists/*
26-
27- COPY --from=build /app/back/package.json .
23+ # Copy package files
24+ COPY --from=build /app/back/package*.json ./
2825
29- RUN npm install --omit=dev
26+ # Install production dependencies only
27+ RUN npm ci --omit=dev
3028
31- COPY --from=build /app/back/src/scripts /app/back/src/ scripts
32- COPY --from=build /app/back/dist /app/back /dist
33- COPY --from=build /app/back/.env .
29+ # Copy built files and scripts
30+ COPY --from=build /app/back/dist . /dist
31+ COPY --from=build /app/back/src/scripts ./src/scripts
3432
3533CMD ["node" , "dist/back/src/sandbox.js" ]
You can’t perform that action at this time.
0 commit comments