-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (31 loc) · 888 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
# Client build (static files)
FROM node:18.19-alpine3.17 AS client-build
WORKDIR /client/app
COPY . .
WORKDIR /client/app/client
RUN yarn
# Server url from backend
ARG VITE_SERVER_URL
ENV VITE_SERVER_URL=$VITE_SERVER_URL
# Url to handle static files
ARG VITE_BASE_BUILD_URL
ENV VITE_BASE_BUILD_URL=$VITE_BASE_BUILD_URL
RUN yarn build
# Server building
FROM node:18.19-alpine3.17 AS server-deps
WORKDIR /app
COPY server/package.json ./
RUN yarn
FROM node:18.19-alpine3.17 AS server-build
WORKDIR /app
COPY server .
COPY --from=server-deps /app/node_modules ./node_modules
RUN yarn prisma:generate
RUN yarn build
FROM node:18.19-alpine3.17 AS runner
WORKDIR /app
COPY --from=server-build /app/node_modules ./node_modules
COPY --from=server-build /app/dist ./dist
COPY --from=client-build /client/app/server/static ./static
COPY server/package.json package.json
CMD ["yarn", "start:prod"]