11# ============================================================
22# STAGE 1: Build the Static Assets
33# ============================================================
4- FROM container-registry.platta-net.hel.fi/devops-toolchain /nodejs-builder-base:1.0 AS staticbuilder
4+ FROM helsinki.azurecr.io /nodejs-builder-base:1.0 AS staticbuilder
55
66# 1. Install dependencies
77# Base already has /app as WORKDIR and default user active
@@ -17,37 +17,30 @@ RUN yarn --frozen-lockfile --ignore-engines --network-concurrency 1 && yarn cach
1717# 3. Copy remaining source files
1818COPY --chown=default:root index.html vite.config.mjs eslint.config.mjs .prettierrc .env* ./
1919COPY --chown=default:root ./src ./src
20- COPY --chown=default:root ./.prod ./.prod
2120
2221# 4. Perform the build
2322ARG REACT_APP_SENTRY_RELEASE
2423ENV REACT_APP_RELEASE=${REACT_APP_SENTRY_RELEASE:-"" }
2524
2625RUN yarn build
2726
28- # 5. Generate the readiness include file
29- RUN export APP_VERSION=$(grep version package.json | awk -F: '{ print $2 }' | sed 's/[", ]//g' ) && \
30- envsubst '${APP_VERSION},${REACT_APP_RELEASE}' < .prod/readiness.conf.template > readiness.conf
3127
3228# ============================================================
3329# STAGE 2: Production Runtime
3430# ============================================================
35- FROM container-registry.platta-net.hel.fi/devops-toolchain /nginx-spa-standard:1.0 AS production
31+ FROM helsinki.azurecr.io /nginx-spa-standard:1.0 AS production
3632USER root
3733RUN rm -rf /etc/nginx/includes/*
3834# 1. Copy the compiled assets
3935COPY --from=staticbuilder /app/build /usr/share/nginx/html
4036
41- # 2. Inject App-Specific Nginx Config
42- COPY --from=staticbuilder /app/readiness.conf /etc/nginx/includes/placeholder.conf
43- COPY .prod/nginx_env.conf /etc/nginx/env/
44-
45- # 3. Setup Runtime Env Injection
37+ # 2. Setup Runtime Env Injection
4638WORKDIR /usr/share/nginx/html
4739COPY ./scripts/env.sh .
4840COPY .env .
41+
42+ # 3. Inject Versioning for the /readiness endpoint from package.json using base image
4943COPY package.json .
5044USER 1001
51- # - USER (Inherited 1001 from base image)
5245# - EXPOSE (Inherited 8080 from base image)
5346# - ENTRYPOINT/CMD (Inherited from base image)
0 commit comments