Skip to content

Commit

Permalink
Merge pull request #1199 from clearlydefined/elr/version-sha
Browse files Browse the repository at this point in the history
add APP_VERSION & BUILD_SHA to Dockerfiles
  • Loading branch information
ljones140 authored Oct 15, 2024
2 parents f0e4562 + ac64319 commit 79c4bdc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
build-and-deploy:
name: Build and Deploy
needs: upload-package-lock-json
uses: clearlydefined/operations/.github/workflows/app-build-and-deploy.yml@v2.0.0
uses: clearlydefined/operations/.github/workflows/app-build-and-deploy.yml@v3.0.0
secrets:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_DEV }}
Expand Down
8 changes: 6 additions & 2 deletions DevDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ ENV APPDIR=/opt/service
# COPY init_container.sh /bin/
# RUN chmod 755 /bin/init_container.sh
# CMD ["/bin/init_container.sh"]
ARG BUILD_NUMBER=0
ENV BUILD_NUMBER=$BUILD_NUMBER

# Set environment variables from build arguments
ARG APP_VERSION="UNKNOWN"
ENV APP_VERSION=$APP_VERSION
ARG BUILD_SHA="UNKNOWN"
ENV BUILD_SHA=$BUILD_SHA

COPY patches /tmp/patches
COPY .npmrc package*.json /tmp/
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ ENV APPDIR=/opt/service
# COPY init_container.sh /bin/
# RUN chmod 755 /bin/init_container.sh
# CMD ["/bin/init_container.sh"]
ARG BUILD_NUMBER=0
ENV BUILD_NUMBER=$BUILD_NUMBER

# Set environment variables from build arguments
ARG APP_VERSION="UNKNOWN"
ENV APP_VERSION=$APP_VERSION
ARG BUILD_SHA="UNKNOWN"
ENV BUILD_SHA=$BUILD_SHA

COPY patches /tmp/patches
COPY .npmrc package*.json /tmp/
Expand Down
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function createApp(config) {
// Bit of trick for local hosting. Preload search if using an in-memory search service
// Commenting out because I believe this is broken
// if (searchService.constructor.name === 'MemorySearch') await definitionService.reload('definitions')
logger.info('Service initialized', { buildNumber: process.env.BUILD_NUMBER })
logger.info('Service initialized', { appVersion: process.env.APP_VERSION })

// kick off the queue processors
require('./providers/curation/process')(curationQueue, curationService, logger)
Expand Down
2 changes: 1 addition & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const express = require('express')
const router = express.Router()

router.get('/', function (req, res) {
const msg = `{ "status": "OK", "version": "${version}", "sha": "${sha}"`
const msg = `{ "status": "OK", "version": "${version}", "sha": "${sha}" }`
res.status(200).send(msg)
})

Expand Down

0 comments on commit 79c4bdc

Please sign in to comment.