diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 41957007..da37c1c6 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -14,6 +14,7 @@ on: env: REGISTRY: ghcr.io IMAGE_PATH: ghcr.io/${{ github.repository }} + DCA_VERSION: ${{ github.REF_NAME }} jobs: build-and-push-image: @@ -50,3 +51,6 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + DCA_VERSION=${{ env.DCA_VERSION }} + diff --git a/Dockerfile b/Dockerfile index ecee0b32..98204915 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ FROM ghcr.io/afwillia/shiny-base:release-update-node -LABEL maintainer="Anthony anthony.williams@sagebase.org" + +# add version tag as a build argument +ARG DCA_VERSION + +ENV DCA_VERSION=$DCA_VERSION USER root RUN apt-get update diff --git a/dca_startup.sh b/dca_startup.sh index 32baa0d8..c1c0cc33 100755 --- a/dca_startup.sh +++ b/dca_startup.sh @@ -3,6 +3,7 @@ # Pass environment variable to Shiny echo "" >> .Renviron echo R_CONFIG_ACTIVE=$R_CONFIG_ACTIVE >> .Renviron +echo DCA_VERSION=$DCA_VERSION >> .Renviron # Now run the base start-up script ./startup.sh diff --git a/global.R b/global.R index 088114fa..585042df 100644 --- a/global.R +++ b/global.R @@ -61,8 +61,18 @@ if (dca_schematic_api == "rest") { Sys.getenv("DCA_API_PORT"), sep = ":") ) + + # Get Schematic version + get_schematic_version <- try(httr::GET(file.path(api_uri, "v1/version")), silent=TRUE) + if (inherits(get_schematic_version, "try-error")) { + schematic_version <- "" + } else if (httr::http_error(get_schematic_version)) { + schematic_version <- "" + } else schematic_version <- httr::content(get_schematic_version) } +dca_version <- Sys.getenv("DCA_VERSION") + dca_synapse_api <- Sys.getenv("DCA_SYNAPSE_PROJECT_API") # update port if running app locally diff --git a/ui.R b/ui.R index 6ded2efd..dd4a377f 100644 --- a/ui.R +++ b/ui.R @@ -294,6 +294,9 @@ ui <- shinydashboardPlus::dashboardPage( ), # waiter loading screen dcWaiter("show", landing = TRUE) + ), + footer = dashboardFooter( + left = sprintf("DCA %s - Schematic %s", dca_version, schematic_version) ) )