forked from uleska-demo-org/demo_UnSAFE_Bank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·30 lines (29 loc) · 989 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
# pull official base image
FROM node:13.12.0-alpine as build
# set working directory
WORKDIR /app
# copy everything to /app directory
COPY . /app
# add the node_modules folder to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install and cache dependencies
RUN yarn -s
# build the project for production
RUN yarn build -s
# set up production environment
# the base image for this is an alpine based nginx image
FROM nginx:alpine
# copy the build folder from react to the root of nginx (www)
COPY --from=build /app/build /usr/share/nginx/html
# --------- only for those using react router ----------
# if you are using react router
# you need to overwrite the default nginx configurations
# remove default nginx configuration file
RUN rm /etc/nginx/conf.d/default.conf
# replace with custom one
COPY nginx/nginx.conf /etc/nginx/conf.d
# --------- /only for those using react router ----------
# expose port 80 to the outer world
EXPOSE 3000
# start nginx
CMD ["nginx", "-g", "daemon off;"]