From 92eb7ce519671e653711e567caf5d56c8ba59f32 Mon Sep 17 00:00:00 2001 From: nemanjam Date: Wed, 15 May 2024 08:32:36 +0200 Subject: [PATCH] pass ARG_SITE_URL in Dockerfile --- .github/workflows/build-push-docker.yml | 3 ++- docker/Dockerfile | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 7559d57..133f72c 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -13,7 +13,6 @@ on: env: IMAGE_NAME: ${{ github.event.repository.name }} - # set this SITE_URL: 'https://docker.nemanjamitic.com' jobs: @@ -58,6 +57,8 @@ jobs: context: ./ # Dockerfile dir file: ./docker/Dockerfile + build-args: | + "ARG_SITE_URL=${{ env.SITE_URL }}" push: true tags: ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest # disabled metadata step diff --git a/docker/Dockerfile b/docker/Dockerfile index 6d5fe5b..af9fe8d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,6 +9,12 @@ FROM base AS build COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile COPY . . + +# build time only env var +ARG ARG_SITE_URL +ENV SITE_URL=$ARG_SITE_URL +RUN echo "SITE_URL=$SITE_URL" + RUN yarn build FROM nginx:stable-alpine3.17-slim AS runtime