Skip to content
Closed
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
24 changes: 24 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ on:
required: false
type: string

# Shell command to test the image before the push. The workflow first
# builds the image for linux/amd64 and loads it into Docker as
# IMAGE (image:tag). The command runs from the repository root.
test:
required: false
type: string

jobs:
docker-workflow:
name: "${{ inputs.image }}:${{ inputs.tag }}"
Expand All @@ -54,6 +61,23 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Build test image
if: inputs.test
uses: docker/build-push-action@v7
with:
context: ${{ inputs.context }}
file: ${{ inputs.dockerfile || format('{0}/Dockerfile', inputs.context) }}
tags: ${{ inputs.image }}:${{ inputs.tag }}
platforms: linux/amd64
load: true
cache-from: type=gha

- name: Test
if: inputs.test
env:
IMAGE: ${{ inputs.image }}:${{ inputs.tag }}
run: ${{ inputs.test }}

- name: Build and push
uses: docker/build-push-action@v7
with:
Expand Down