-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (35 loc) · 970 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
FROM node:alpine as server-base
ENV CI=true
WORKDIR /app
COPY ./server/package.json .
RUN yarn install
COPY ./server .
FROM node:alpine as server-build
WORKDIR /app
COPY --from=server-base /app .
RUN yarn build
FROM node:alpine as server-deps
WORKDIR /app
COPY ./server/package.json .
RUN yarn install --prod
FROM node:alpine as react-build
WORKDIR /app
COPY ./client/package.json .
RUN yarn install
COPY ./client .
RUN yarn build
FROM node:alpine as pkg
WORKDIR /app
# static assets and react build
COPY --from=server-base /app/assets /app/assets
COPY --from=react-build /app/build /app/react
# server node_modules and compiled JS for server
COPY --from=server-deps /app/node_modules /app/node_modules
COPY --from=server-build /app/build /app/src
# Package into executable binary
COPY ./server/pkg.config.json .
RUN npx pkg@4.5.1 ./src/index.js -c ./pkg.config.json
FROM gcr.io/distroless/cc
COPY --from=pkg /app/build/index /app/index
WORKDIR /app
CMD ["./index"]