Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow building Docker image via script
- callers can pass in the optional variable `docker_build_script`
- script should produce a Docker image
- if the script variable is set the default Docker image build step
  isn't executed

See exercism/java-test-runner#147 for context
  • Loading branch information
fapdash committed Mar 14, 2025
commit a71d92abe46ec3c7a5f103dc0727b57000a057a0
10 changes: 9 additions & 1 deletion .github/workflows/docker-build-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
default: true
required: false
type: boolean
docker_build_script:
description: "Script that produces a Docker image"
required: false
type: string
provenance:
description: "Generate provenance attestation for the build"
default: true
Expand Down Expand Up @@ -95,8 +99,12 @@ jobs:
username: ${{ secrets.AWS_ECR_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_ECR_SECRET_ACCESS_KEY }}

- name: Build Docker image via build script
if: ${{ inputs.docker_build_script && steps.dockerfile-exists.outputs.result == 'true' && (inputs.docker_hub || inputs.aws_ecr)}}
run: ${{ inputs.docker_build_script }}

- name: Build Docker image
if: ${{steps.dockerfile-exists.outputs.result == 'true' && (inputs.docker_hub || inputs.aws_ecr)}}
if: ${{ !inputs.docker_build_script && steps.dockerfile-exists.outputs.result == 'true' && (inputs.docker_hub || inputs.aws_ecr)}}
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
with:
context: .
Expand Down