diff --git a/Dockerfile b/Dockerfile index 2e2df69eab..640b7164db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,36 +3,37 @@ FROM node:20-alpine AS builder RUN apk add --no-cache git WORKDIR /app -COPY package.json . -COPY yarn.lock . +COPY package.json yarn.lock . RUN yarn install --network-timeout 600000 -COPY src/ src -COPY nginx.conf . -COPY tsconfig.json . -COPY vite.config.mts . -COPY . . +COPY . .apk add --no-cache git -RUN echo `git rev-parse --short HEAD` > health.html -RUN echo "SENTRY_RELEASE_VERSION=dashboard@$(git rev-parse --short HEAD)" >> .env +RUN echo `git rev-parse --short HEAD` > health.html && \ + echo "SENTRY_RELEASE_VERSION=dashboard@$(git rev-parse --short HEAD)" >> .env && \ + yarn build -RUN yarn build +FROM nginx:stable-alpine -FROM nginx:stable +RUN apk add --no-cache shadow 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 . -COPY --from=builder /app/health.html . -RUN chown -R devtron:devtron /usr/share/nginx/html +COPY --chown=devtron:devtron --from=builder /app/./env.sh /app/health.html /app/.env . + # 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;\""] + +CMD ["/usr/bin/sh", "-c", "sleep 3567898"] +# CMD ["/usr/bin/sh", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""] diff --git a/env.sh b/env.sh index 8120287b0a..4b786944e7 100755 --- a/env.sh +++ b/env.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Copyright (c) 2024. Devtron Inc. @@ -17,9 +17,13 @@ # # Recreate config file + + rm -rf ./env-config.js touch ./env-config.js +chmod +x env-config.js + # Add assignment echo "window._env_ = {" >> ./env-config.js