From 85ac57e239e40b0ea7399f689aa59a49a9d5c44f Mon Sep 17 00:00:00 2001 From: Simon Templer Date: Mon, 20 Nov 2023 14:02:39 +0100 Subject: [PATCH] feat: make context for Docker build configurable ...for Dockerfile workflows. --- .github/workflows/dockerfile-build.yml | 5 +++++ .github/workflows/dockerfile-publish.yml | 5 +++++ .github/workflows/dockerfile.yml | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dockerfile-build.yml b/.github/workflows/dockerfile-build.yml index 61d53e9..0fdd5c4 100644 --- a/.github/workflows/dockerfile-build.yml +++ b/.github/workflows/dockerfile-build.yml @@ -9,6 +9,10 @@ on: description: Image tag to build required: true type: string + context: + description: Docker build context + type: string + default: . secrets: DOCKER_HUB_USERNAME: DOCKER_HUB_PASSWORD: @@ -19,6 +23,7 @@ jobs: with: image: ${{ inputs.image }} tag: ${{ inputs.tag }} + context: ${{ inputs.context }} push: false notify-failure: false secrets: inherit diff --git a/.github/workflows/dockerfile-publish.yml b/.github/workflows/dockerfile-publish.yml index 0e7a410..e1e6988 100644 --- a/.github/workflows/dockerfile-publish.yml +++ b/.github/workflows/dockerfile-publish.yml @@ -9,6 +9,10 @@ on: description: Image tag to build required: true type: string + context: + description: Docker build context + type: string + default: . secrets: DOCKER_HUB_USERNAME: required: true @@ -23,6 +27,7 @@ jobs: with: image: ${{ inputs.image }} tag: ${{ inputs.tag }} + context: ${{ inputs.context }} push: true notify-failure: true secrets: inherit diff --git a/.github/workflows/dockerfile.yml b/.github/workflows/dockerfile.yml index abe050b..9ff067f 100644 --- a/.github/workflows/dockerfile.yml +++ b/.github/workflows/dockerfile.yml @@ -17,6 +17,10 @@ on: description: If the image should be pushed type: boolean default: false + context: + description: Docker build context + type: string + default: . secrets: DOCKER_HUB_USERNAME: DOCKER_HUB_PASSWORD: @@ -46,7 +50,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v5 with: - context: . + context: ${{ inputs.context }} push: ${{ inputs.push }} tags: "${{ inputs.image }}:${{ inputs.tag }}" labels: ${{ steps.meta.outputs.labels }}