Projekt

Obecné

Profil

Stáhnout (1.06 KB) Statistiky
| Větev: | Tag: | Revize:
1
# STAGE 1 - build the react app # set the base image to build from
2
# This is the application image from which all other subsequent
3
# applications run. Alpine Linux is a security-oriented, lightweight #(~5Mb) Linux distribution.
4
FROM node:alpine as build
5
# set working directory
6
# this is the working folder in the container from which the app.   # will be running from
7
WORKDIR /app
8

    
9
# add the node_modules folder to $PATH
10
ENV PATH /app/node_modules/.bin:$PATH
11

    
12
# copy package.json file to /app directory for installation prep
13
COPY ./package.json /app/
14

    
15
# install dependencies
16
RUN yarn --silent
17

    
18
# copy everything to /app directory
19
COPY . /app
20

    
21
# build the app
22
RUN yarn build
23

    
24
# STAGE 2 - build the final image using a nginx web server
25
# distribution and copy the react build files
26
FROM nginx:alpine
27
COPY --from=build /app/build /usr/share/nginx/html
28

    
29
# needed this to make React Router work properly
30
RUN rm /etc/nginx/conf.d/default.conf
31
COPY nginx/nginx.conf /etc/nginx/conf.d
32

    
33
# Expose port 80 for HTTP Traffic
34
EXPOSE 80
35

    
36
# start the nginx web server
37
CMD ["nginx", "-g", "daemon off;"]
(3-3/7)