-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (28 loc) · 876 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
# BUILD STAGE
FROM node:20 as build-stage
WORKDIR /app
ARG REACT_APP_SOCKET_URL
ENV REACT_APP_SOCKET_URL=$REACT_APP_SOCKET_URL
# copying the all the frontend and backend code
COPY frontend ./frontend
COPY backend ./backend
# installing the frontend and backend dependencies
RUN cd frontend && npm install
RUN cd backend && npm install
# building the frontend UI from the backend
RUN cd backend && npm run build:ui
# compiling TypeScript code
RUN cd backend && npm run tsc
# RUN STAGE
FROM node:20 as run-stage
WORKDIR /app
# copying the built frontend and backend code
COPY --from=build-stage /app/backend/build /app
# copying the backend package.json
COPY --from=build-stage /app/backend/package.json /app
# Installing the backend dependencies
RUN npm install --omit=dev
# Set NODE_ENV to production
ENV NODE_ENV=production
EXPOSE 3001
CMD ["node", "index.js"]