-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathDockerfile
64 lines (51 loc) · 1.74 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM node:14.19.3-buster AS builder
WORKDIR /data/
RUN chmod -R a+rw /data/
RUN addgroup --gid 1024 nodegroup
## add user node to the group with GID 1024
RUN adduser node nodegroup
RUN chown -R node:nodegroup /data
USER node
COPY --chown=node:nodegroup package.json /data/
RUN npm install
ENV PATH=/data/node_modules/.bin:$PATH
RUN next telemetry disable
# COPY . .
COPY --chown=node:nodegroup . .
COPY ./docker/entrypoint.sh /entrypoint/
USER root
RUN ["chmod", "+x", "/entrypoint/entrypoint.sh"]
USER node
ARG SERVER_URL
RUN next telemetry status
RUN npm run build
ENTRYPOINT ["/entrypoint/entrypoint.sh"]
FROM nginx:stable-alpine as production
ARG NGINX_PORT
ARG API_URL
ARG SERVER_URL
# Change gid for the nginx user
# To have usermod and groupmod, I have to install the shadow package.
RUN apk --no-cache add shadow && \
groupmod -g 1024 -o nginx
# COPY --from=builder /data/dist /usr/share/nginx/html
COPY --from=builder /data/out /usr/share/nginx/html
RUN ls -al /usr/share/nginx/html
COPY docker/nginx.conf.template /etc/nginx/conf.d/nginx.conf.template
RUN export
RUN sh -c "envsubst \"`env | awk -F = '{printf \" \\\\$%s\", $1}'`\" < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/custom.conf"
# RUN ps fax
# CMD ["cat", "/etc/nginx/conf.d/custom.conf"]
# CMD ["/usr/sbin/nginx", "-s", "reload", "-c", "/etc/nginx/conf.d/custom.conf"]
# ENTRYPOINT ["nginx" , "-g", "daemon off;"]
# RUN cat /docker-entrypoint.sh
# ENTRYPOINT [ "/docker-entrypoint.sh", $@ ]
# FROM node:lts-alpine as app
# USER node
# WORKDIR /data/
# ## Copy built node modules and binaries without including the toolchain
# COPY --from=builder /data/node_modules .
# ENV PATH=/data/node_modules/.bin:$PATH
# COPY . .
# EXPOSE 8080
# ENTRYPOINT ["/entrypoint/entrypoint.sh"]