-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (37 loc) · 1.33 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#
# NodeJS installing dependencies and building frontend
#
FROM node:alpine AS builder
WORKDIR /code
COPY . /code
RUN npm install \
&& npm run build
#
# NGINX provisioning frontend
#
FROM nginx:alpine AS runner
LABEL maintainer="Gabriel Tiossi<[email protected]>"
WORKDIR /usr/share/nginx/html
# Generate NGINX vhost
RUN echo $\
'server { \n\
listen 8080; \n\
server_name localhost; \n\
\n\
location / { \n\
root /usr/share/nginx/html; \n\
index index.html index.htm; \n\
} \n\
\n\
error_page 500 502 503 504 /50x.html; \n\
location = /50x.html { \n\
root /usr/share/nginx/html; \n\
} \n\
}' > /etc/nginx/conf.d/default.conf
# Copy from "builder" to "runner" container
COPY --from=builder --chown=nginx:nginx /code/dist /usr/share/nginx/html
# Fix permission issues changing nginx.pid location
RUN sed -i "s,/var/run/nginx.pid,/tmp/nginx.pid,g" /etc/nginx/nginx.conf
USER nginx
EXPOSE 8080/tcp
CMD ["nginx", "-g", "daemon off;"]