diff --git a/.prod/nginx.conf b/.prod/nginx.conf index 96963a723..e56bc8b9f 100644 --- a/.prod/nginx.conf +++ b/.prod/nginx.conf @@ -23,7 +23,9 @@ http { } location /readiness { - return 200 'OK'; + add_header Content-Type application/json; + add_header Cache-Control "no-cache, no-store, must-revalidate"; + return 200 '{"status": "ok", "release": "${REACT_APP_RELEASE}", "packageVersion": "${APP_VERSION}"}'; } location / { diff --git a/Dockerfile b/Dockerfile index d60c35870..2ecf4a3c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,8 +57,17 @@ FROM appbase as staticbuilder WORKDIR /app +ARG REACT_APP_SENTRY_RELEASE + +ENV REACT_APP_RELEASE=${REACT_APP_SENTRY_RELEASE:-""} + RUN yarn build +# Process nginx configuration with APP_VERSION substitution +COPY .prod/nginx.conf /app/nginx.conf.template +RUN export APP_VERSION=$(yarn --silent app:version | tr -d '\n') && \ + envsubst '${APP_VERSION},${REACT_APP_RELEASE}' < /app/nginx.conf.template > /app/nginx.conf + # ============================= FROM registry.access.redhat.com/ubi9/nginx-122 as production # ============================= @@ -71,8 +80,8 @@ RUN chgrp -R 0 /usr/share/nginx/html && \ # Copy static build COPY --from=staticbuilder /app/build /usr/share/nginx/html -# Copy nginx config -COPY .prod/nginx.conf /etc/nginx/nginx.conf +# Copy processed nginx config from build stage +COPY --from=staticbuilder /app/nginx.conf /etc/nginx/nginx.conf RUN mkdir /etc/nginx/env COPY .prod/nginx_env.conf /etc/nginx/env/ diff --git a/package.json b/package.json index 5077bce5a..413c849b5 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "node": ">=22.13.1" }, "scripts": { + "app:version": "echo \"$npm_package_version\"", "start": "if test $NODE_MAX_MEMORY_MIB ; then node --max-old-space-size=$NODE_MAX_MEMORY_MIB yarn clear-babel-cache && yarn update-runtime-env && vite ; else yarn clear-babel-cache && yarn update-runtime-env && vite ; fi", "build": "vite build", "serve": "vite preview",