-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (28 loc) · 852 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
# === Stage 1: Build the client ===
FROM node:14 AS client-builder
WORKDIR /usr/app/client
COPY ./client/package*.json ./
RUN npm install
COPY ./client ./
RUN npm run build
# === Stage 2: Build the server and create the final Docker image ===
FROM node:14 AS server-builder
WORKDIR /usr/app
COPY ./server/package*.json ./
RUN npm install
COPY ./server .
RUN npx prisma generate
RUN npm run build
# === Stage 3: Create the final Docker image ===
FROM node:14
WORKDIR /usr/app
# Copy only the compiled 'dist' folder from server and 'build' folder from client
COPY --from=server-builder /usr/app/dist ./dist
COPY --from=client-builder /usr/app/client/build ./dist/build
COPY ./server/prisma ./prisma
COPY ./server/package*.json ./
RUN npm install --production
RUN npx prisma generate
EXPOSE 80
# Start the server
CMD ["npm", "start"]