-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (20 loc) · 1008 Bytes
/
Dockerfile
File metadata and controls
33 lines (20 loc) · 1008 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
FROM node:18-alpine As build
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
COPY --chown=node:node apps/backend/package*.json ./apps/backend/
COPY --chown=node:node apps/frontend/package*.json ./apps/frontend/
RUN npm install
COPY --chown=node:node . .
RUN npm run build
RUN npm cache clean --force
USER node
FROM node:18-alpine As production
ENV ENV=production
# Copy the bundled code from the build stage to the production image
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/apps/backend/node_modules ./apps/backend/node_modules
COPY --chown=node:node --from=build /usr/src/app/apps/frontend/node_modules ./apps/frontend/node_modules
COPY --chown=node:node --from=build /usr/src/app/apps/backend/dist ./apps/backend/dist
COPY --chown=node:node --from=build /usr/src/app/apps/frontend/dist ./apps/frontend/dist
# Start the server using the production build
CMD [ "node", "apps/backend/dist/main.js" ]