From a3acb90b3e3adc4f87e7e66d4eb402190f5a349a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serge=20H=C3=A4nni?= Date: Sun, 2 Oct 2022 21:44:07 +0200 Subject: [PATCH] Add code version to docker image --- .github/workflows/build_image.yml | 1 + Dockerfile | 3 +++ app/views/pages/home.html.haml | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_image.yml index 2890948..b255596 100644 --- a/.github/workflows/build_image.yml +++ b/.github/workflows/build_image.yml @@ -40,3 +40,4 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: CODE_VERSION:${{ steps.meta.outputs.tags[0] }} diff --git a/Dockerfile b/Dockerfile index af592c9..04a8253 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,9 @@ COPY Gemfile /app COPY Gemfile.lock /app RUN bundle config set --local without 'development test'; bundle install +ARG CODE_VERSION +ENV CODE_VERSION=${CODE_VERSION:-development} + COPY . /app RUN bin/rails assets:precompile diff --git a/app/views/pages/home.html.haml b/app/views/pages/home.html.haml index 240691d..3c2a6d8 100644 --- a/app/views/pages/home.html.haml +++ b/app/views/pages/home.html.haml @@ -84,3 +84,8 @@ - if lookup_context.exists?('data_privacy', 'pages') .pl-3.text-xs.text-grey-foreground.dark:text-dark-grey-foreground(style="grid-column: span 2") = link_to t('footer.data_privacy'), page_path(:data_privacy) + + - if ENV["CODE_VERSION"].present? + .pl-3.text-xs.text-grey-foreground.dark:text-dark-grey-foreground(style="grid-column: span 2") + version + = ENV["CODE_VERSION"]