-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
30 lines (28 loc) · 905 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
FROM mhart/alpine-node:10 AS build
LABEL Dhian Trisna Alyusi
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
ARG staging_api_url
ENV API_URL=$staging_api_url
ARG staging_client_key
ENV CLIENT_KEY=$staging_client_key
ARG staging_base_url
ENV BASE_URL=$staging_base_url
COPY package.json /usr/src/app/package.json
RUN echo "REACT_APP_API_URL=${staging_api_url}" >> /usr/src/app/.env
RUN echo "REACT_APP_CLIENT_KEY=${staging_client_key}" >> /usr/src/app/.env
RUN echo "BASE_URL=${staging_base_url}" >> /usr/src/app/.env
RUN npm cache clean --force
RUN npm install
RUN npm install react-scripts -g --silent
COPY . /usr/src/app
RUN npm run-script build
FROM mhart/alpine-node:10
RUN mkdir -p /app
COPY ./server /app/server
WORKDIR /app/server
RUN npm install --silent
COPY --from=build /usr/src/app/build /app/server/public
EXPOSE 8092
CMD [ "node", "server.js" ]