Skip to content

Commit 46e6011

Browse files
committed
fix: optmise 2nd stage dockerfile
1 parent 79cdc64 commit 46e6011

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

Dockerfile

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,30 @@ RUN echo `git rev-parse --short=9 HEAD` > health.html && \
2121

2222
RUN yarn build
2323

24-
FROM fholzer/nginx-brotli:v1.26.2
24+
FROM fholzer/nginx-brotli:v1.26.2Add commentMore actions
25+
26+
# Install bash
27+
RUN apk add --no-cache bash shadow
28+
29+
RUN useradd -m -s /bin/bash devtron
30+
2531

26-
RUN useradd -ms /bin/bash devtron
2732
COPY --from=builder /app/dist/ /usr/share/nginx/html
2833
COPY ./nginx.conf /etc/nginx/nginx.conf
2934
COPY ./nginx-default.conf /etc/nginx/conf.d/default.conf
35+
3036
WORKDIR /usr/share/nginx/html
31-
COPY --from=builder /app/./env.sh .
32-
COPY --from=builder /app/.env .
33-
COPY --from=builder /app/health.html .
3437

35-
# Make our shell script executable
38+
COPY --from=builder /app/env.sh .
39+
COPY --from=builder /app/.env .
40+
COPY --from=builder /app/health.html .
41+
3642
RUN chown -R devtron:devtron /usr/share/nginx/html && \
37-
chmod +x env.sh
43+
chmod +x env.sh
44+
3845
USER devtron
39-
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]
46+
47+
# Override the default ENTRYPOINT to allow shell scripting as fholzer/nginx-brotli has by-default entrypoint of nginx
48+
ENTRYPOINT ["/bin/bash", "-c"]
49+
50+
CMD ["./env.sh && nginx -g 'daemon off;'"]

0 commit comments

Comments
 (0)