-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (28 loc) · 882 Bytes
/
Dockerfile
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 Frontend
FROM node:18.15-bullseye-slim AS frontend-builder
COPY ./frontend/package.json /frontend/package.json
WORKDIR /frontend
RUN npm install -g npm@9
RUN npm install
COPY ./frontend /frontend
RUN npm run build
# Build Backend
FROM node:18.15-bullseye-slim AS backend-builder
COPY ./backend/package.json /backend/package.json
WORKDIR /backend
RUN npm install -g npm@9
RUN npm install
COPY ./backend /backend
RUN npm run build
# Build Production Image
FROM node:18.15-bullseye-slim
COPY --from=backend-builder /backend/package.json /app/package.json
WORKDIR /app
RUN npm install -g npm@9
RUN npm install
COPY --from=frontend-builder /frontend/dist /app/public
COPY --from=backend-builder /backend/asset/ /app/public/assets/
COPY --from=backend-builder /backend/dist /app/dist
EXPOSE 3000
ENV NODE_ENV=production
CMD [ "npm", "run", "start:prod" ]