diff --git a/.github/workflows/build-and-deploy-dev.yml b/.github/workflows/build-and-deploy-dev.yml index 5f3cc507a..17ecc847b 100644 --- a/.github/workflows/build-and-deploy-dev.yml +++ b/.github/workflows/build-and-deploy-dev.yml @@ -33,7 +33,7 @@ jobs: build-and-deploy: name: Build and Deploy needs: [upload-package-lock-json, make-react-secret-available] - uses: clearlydefined/operations/.github/workflows/app-build-and-deploy.yml@v2.0.0 + uses: clearlydefined/operations/.github/workflows/app-build-and-deploy.yml@v3.1.2 secrets: AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_DEV }} diff --git a/Dockerfile b/Dockerfile index 473e10d73..3fc08f625 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,13 @@ FROM node:14-alpine as builder COPY . /opt/website WORKDIR /opt/website + +# Set environment variables from build arguments +ARG APP_VERSION="UNKNOWN" +ENV APP_VERSION=$APP_VERSION +ARG BUILD_SHA="UNKNOWN" +ENV BUILD_SHA=$BUILD_SHA + ARG REACT_APP_SERVER=http://localhost:4000 ARG REACT_APP_GA_TRACKINGID RUN apk add --no-cache git @@ -10,7 +17,14 @@ RUN npm install -g npm@9 RUN npm install RUN npm run build -FROM nginx:alpine -ADD nginx.conf /etc/nginx/conf.d/default.conf +FROM nginx:1.19.6-alpine + +ARG APP_VERSION="UNKNOWN" +ENV APP_VERSION=$APP_VERSION +ARG BUILD_SHA="UNKNOWN" +ENV BUILD_SHA=$BUILD_SHA + +RUN mkdir /etc/nginx/templates +COPY default.conf.template /etc/nginx/templates COPY --from=builder /opt/website/build /usr/share/nginx/html EXPOSE 80 diff --git a/nginx.conf b/default.conf.template similarity index 77% rename from nginx.conf rename to default.conf.template index da657ecb0..2751d79f5 100644 --- a/nginx.conf +++ b/default.conf.template @@ -12,6 +12,11 @@ server { etag off; } + location /health { + add_header 'Content-Type' 'application/json'; + return 200 '{"status":"OK", "version": "${APP_VERSION}", "sha": "${BUILD_SHA}"}'; + } + # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html;