-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
39 lines (27 loc) · 1001 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
31
32
33
34
35
36
37
38
39
FROM node:20 AS dependencies
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
FROM dependencies AS builder
RUN yarn build
FROM nginx:1.20
LABEL io.k8s.description="Platform for serving static HTML files" \
io.k8s.display-name="Nginx 1.20"
COPY --from=builder /app/build /usr/share/nginx/html/
COPY .env /usr/share/nginx/html/
COPY env-config.js /usr/share/nginx/html/
COPY conf/nginx.conf /etc/nginx/nginx.conf
COPY conf/conf.d/default.conf.template /tmp
COPY conf/conf.d/default.conf /etc/nginx/conf.d/default.conf
RUN chown -R nginx:nginx /usr/share/nginx/html && \
chmod -R 755 /usr/share/nginx/html && \
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
chown -R nginx:nginx /etc/nginx/conf.d
RUN touch /var/run/nginx.pid && chown -R nginx:nginx /var/run/nginx.pid
COPY env.sh /tmp
RUN chmod +x /tmp/env.sh
USER nginx
EXPOSE 8080
CMD ["/bin/bash", "-c", "cd /usr/share/nginx/html && /tmp/env.sh && nginx -g \"daemon off;\""]