-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.client
44 lines (43 loc) · 1.68 KB
/
Dockerfile.client
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
FROM node:14 AS client-builder
WORKDIR /home/node/app
ENV NODE_ENV production
COPY ./client/package.json .
COPY ./client/yarn.lock .
COPY ./client/.yarnrc.yml .
COPY ./client/.yarn ./.yarn
RUN yarn install && yarn cache clean
COPY ./client .
ARG REACT_APP_TITLE=${REACT_APP_TITLE}
ARG REACT_APP_DESCRIPTION=${REACT_APP_DESCRIPTION}
ARG REACT_APP_USE_SESSION_STORAGE=${REACT_APP_USE_SESSION_STORAGE}
ARG REACT_APP_GET_AVATARS_FROM=${REACT_APP_GET_AVATARS_FROM}
ARG REACT_APP_NAKAMA_SERVER_KEY=${REACT_APP_NAKAMA_SERVER_KEY}
ARG REACT_APP_NAKAMA_HOST=${REACT_APP_NAKAMA_HOST}
ARG REACT_APP_NAKAMA_PORT=${REACT_APP_NAKAMA_PORT}
ARG REACT_APP_NAKAMA_USE_SSL=${REACT_APP_NAKAMA_USE_SSL}
ENV REACT_APP_TITLE=${REACT_APP_TITLE}
ENV REACT_APP_DESCRIPTION=${REACT_APP_DESCRIPTION}
ENV REACT_APP_USE_SESSION_STORAGE=${REACT_APP_USE_SESSION_STORAGE}
ENV REACT_APP_GET_AVATARS_FROM=${REACT_APP_GET_AVATARS_FROM}
ENV REACT_APP_NAKAMA_SERVER_KEY=${REACT_APP_NAKAMA_SERVER_KEY}
ENV REACT_APP_NAKAMA_HOST=${REACT_APP_NAKAMA_HOST}
ENV REACT_APP_NAKAMA_PORT=${REACT_APP_NAKAMA_PORT}
ENV REACT_APP_NAKAMA_USE_SSL=${REACT_APP_NAKAMA_USE_SSL}
RUN yarn build
FROM node:14
WORKDIR /home/node/app
ENV NODE_ENV production
COPY ./web-server/package.json .
COPY ./web-server/yarn.lock .
COPY ./web-server/.yarnrc.yml .
COPY ./web-server/.yarn ./.yarn
RUN yarn install && yarn add pm2 && yarn cache clean
COPY --chown=node:node ./web-server .
COPY --from=client-builder --chown=node:node /home/node/app/build ./public
USER node
EXPOSE 9000
ENV PORT 9000
ENV CLIENT_BUILD_PATH /home/node/app/public
ARG FRAME_ANCESTORS=${FRAME_ANCESTORS}
ENV FRAME_ANCESTORS=${FRAME_ANCESTORS}
CMD [ "./node_modules/.bin/pm2-runtime", "start", "./src/index.js" ]