diff --git a/Dockerfile b/Dockerfile index 2e2df69eab..95ec0bd4ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,40 @@ FROM node:20-alpine AS builder -RUN apk add --no-cache git - WORKDIR /app -COPY package.json . -COPY yarn.lock . - -RUN yarn install --network-timeout 600000 -COPY src/ src -COPY nginx.conf . -COPY tsconfig.json . -COPY vite.config.mts . -COPY . . +COPY package.json yarn.lock . -RUN echo `git rev-parse --short HEAD` > health.html +RUN apk add --no-cache git && \ + yarn install --network-timeout 600000 -RUN echo "SENTRY_RELEASE_VERSION=dashboard@$(git rev-parse --short HEAD)" >> .env +COPY . . -RUN yarn build +RUN echo `git rev-parse --short HEAD` > health.html && \ + echo "SENTRY_RELEASE_VERSION=dashboard@$(git rev-parse --short HEAD)" >> .env && \ + yarn build FROM nginx:stable RUN useradd -ms /bin/bash devtron + COPY --from=builder /app/dist/ /usr/share/nginx/html + COPY ./nginx.conf /etc/nginx/nginx.conf + COPY ./nginx-default.conf /etc/nginx/conf.d/default.conf + WORKDIR /usr/share/nginx/html -COPY --from=builder /app/./env.sh . + +COPY --from=builder /app/./env.sh . + COPY --from=builder /app/.env . + COPY --from=builder /app/health.html . RUN chown -R devtron:devtron /usr/share/nginx/html # Make our shell script executable RUN chmod +x env.sh + USER devtron + CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]