forked from junron/nush-chess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (36 loc) · 1.1 KB
/
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
FROM node:alpine AS base
# build the frontend
RUN npm i -g pnpm
RUN apk --no-cache add --virtual build-deps build-base
FROM base AS frontend-dependencies
WORKDIR /app/
COPY ./frontend/package.json ./frontend/pnpm-lock.yaml ./
RUN pnpm i -P
RUN apk del build-deps
FROM base AS frontend-build
WORKDIR /app/
COPY ./frontend .
COPY --from=frontend-dependencies /app/node_modules ./node_modules
RUN pnpm run build
RUN pnpm prune --prod
FROM base AS server-dependencies
WORKDIR /app/
COPY ./server/package.json ./server/pnpm-lock.yaml ./
RUN pnpm i -P
RUN apk del build-deps
FROM base AS server-build
WORKDIR /app/
COPY ./server .
COPY --from=server-dependencies /app/node_modules ./node_modules
RUN pnpm run build
RUN pnpm prune --prod
FROM base AS deploy
WORKDIR /app/
COPY /server/package.json /server/pnpm-lock.yaml ./server/
COPY --from=frontend-build /app/dist ./frontend/dist
COPY --from=server-build /app/node_modules ./server/node_modules
COPY --from=server-build /app/built ./server/built
COPY --from=server-build /app/config.json ./server/config.json
WORKDIR /app/server/
EXPOSE 3001
CMD ["pnpm", "start"]