Projekt

Obecné

Profil

Stáhnout (1.12 KB) Statistiky
| Větev: | Tag: | Revize:
1
#############
2
### build ###
3
#############
4

    
5
# base image
6
FROM node:12.2.0 as build
7

    
8
# set working directory
9
WORKDIR /app
10

    
11
# add `/app/node_modules/.bin` to $PATH
12
ENV PATH /app/node_modules/.bin:$PATH
13

    
14
# copy package.json and package-lock.json to container
15
COPY package.json package-lock.json ./
16

    
17
# install and cache app dependencies
18
RUN npm install
19

    
20
# add app
21
COPY . /app
22

    
23
# run tests - COMMENTED, later
24
#RUN npm run test
25

    
26
# generate build
27
RUN npm run build
28

    
29
############
30
### prod ###
31
############
32

    
33
# inspired by https://torstenwalter.de/openshift/nginx/2017/08/04/nginx-on-openshift.html
34

    
35
# base image
36
FROM nginx:1.16.0-alpine
37

    
38
# support running as arbitrary user which belogs to the root group
39
RUN chmod g+rwx /var/cache/nginx /var/run /var/log/nginx
40

    
41
# expose port 8081
42
EXPOSE 8081
43

    
44
# comment user directive as master process is run as user in OpenShift anyhow
45
RUN sed -i.bak 's/^user/#user/' /etc/nginx/nginx.conf
46

    
47
# copy nginx configuration
48
COPY nginx.conf /etc/nginx/conf.d/default.conf
49

    
50
# copy artifact build from the 'build environment'
51
COPY --from=build /app/build /usr/share/nginx/html
52

    
53
# run nginx
54
CMD ["nginx", "-g", "daemon off;"]
(6-6/11)