1- FROM node:20-alpine AS builder
2-
3- RUN apk add --no-cache git
1+ FROM node:22-alpine AS builder
42
53WORKDIR /app
4+
5+ RUN corepack enable yarn && \
6+ yarn set version 4.9.2
7+
68COPY package.json .
79COPY yarn.lock .
10+ COPY .yarn/ .yarn/
11+ COPY .yarnrc.yml ./
812
9- RUN yarn install --frozen-lockfile --network-timeout 600000
13+ RUN apk add --no-cache git
14+ RUN yarn install --immutable --network-timeout 600000
1015
11- COPY src/ src
12- COPY nginx.conf .
13- COPY tsconfig.json .
14- COPY vite.config.mts .
1516COPY . .
1617
17- RUN echo `git rev-parse --short=9 HEAD` > health.html
18+ RUN echo `git rev-parse --short=9 HEAD` > health.html && \
19+ echo "" >> .env && \
20+ echo "SENTRY_RELEASE_VERSION=dashboard@$(git rev-parse --short=9 HEAD)" >> .env && \
21+ yarn build
1822
19- RUN echo "" >> .env && \
20- echo "SENTRY_RELEASE_VERSION=dashboard@$(git rev-parse --short=9 HEAD)" >> .env
23+ FROM fholzer/nginx-brotli:v1.26.2
2124
22- RUN yarn build
25+ # Install bash
26+ RUN apk add --no-cache bash shadow
2327
24- FROM nginx:stable
28+ RUN useradd -m -s /bin/bash devtron
2529
26- RUN useradd -ms /bin/bash devtron
2730COPY --from=builder /app/dist/ /usr/share/nginx/html
2831COPY ./nginx.conf /etc/nginx/nginx.conf
2932COPY ./nginx-default.conf /etc/nginx/conf.d/default.conf
33+
3034WORKDIR /usr/share/nginx/html
31- COPY --from=builder /app/./env.sh .
32- COPY --from=builder /app/.env .
33- COPY --from=builder /app/health.html .
3435
35- RUN chown -R devtron:devtron /usr/share/nginx/html
36- # Make our shell script executable
37- RUN chmod +x env.sh
36+ COPY --from=builder /app/env.sh .
37+ COPY --from=builder /app/.env .
38+ COPY --from=builder /app/health.html .
39+
40+ RUN chown -R devtron:devtron /usr/share/nginx/html && \
41+ chmod +x env.sh
42+
3843USER devtron
39- CMD ["/bin/bash" , "-c" , "/usr/share/nginx/html/env.sh && nginx -g \" daemon off;\" " ]
44+
45+ # Override the default ENTRYPOINT to allow shell scripting as fholzer/nginx-brotli has by-default entrypoint of nginx
46+ ENTRYPOINT ["/bin/bash" , "-c" ]
47+
48+ CMD ["./env.sh && nginx -g 'daemon off;'" ]
0 commit comments