From 9819c2ffc15c1206f223bd78d5190fe454d4ca0f Mon Sep 17 00:00:00 2001 From: FinemechanicPub <93194456+FinemechanicPub@users.noreply.github.com> Date: Tue, 13 Aug 2024 20:24:56 +0300 Subject: [PATCH] Fix environment variables handling --- .github/workflows/build-backend.yml | 3 +++ backend/Dockerfile | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml index b809c2d..d25233d 100644 --- a/.github/workflows/build-backend.yml +++ b/.github/workflows/build-backend.yml @@ -83,6 +83,9 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + "GITHUB_REF=${{ github.ref }}" + "GITHUB_SHA=${{ github.sha }}" # This step generates an artifact attestation for the image, # which is an unforgeable statement about where and how it was built. diff --git a/backend/Dockerfile b/backend/Dockerfile index 18b9510..b081caf 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -13,6 +13,8 @@ COPY ./manage.py ./manage.py # Swith user USER puzzle # Set variables +ARG GITHUB_REF +ARG GITHUB_SHA ENV BRANCH=${GITHUB_REF} ENV COMMIT=${GITHUB_SHA} # Run server