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
17 changes: 14 additions & 3 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: docker
# Reusable: build one image and push it to GHCR (push skipped on pull requests).
# Build one image and push it to GHCR. Push and tags optional.
on:
workflow_call:
inputs:
Expand All @@ -11,6 +11,16 @@ on:
description: "Build context directory"
required: true
type: string
tag:
description: "Extra tag to publish, e.g. pr-12-a1b2c3d. Empty to rely on the tags derived from the ref."
required: false
default: ""
type: string
push:
description: "Push to GHCR. False builds only, which still checks the Dockerfile."
required: false
default: false
type: boolean

jobs:
build-and-push:
Expand All @@ -22,6 +32,7 @@ jobs:
- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
if: inputs.push
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -34,11 +45,11 @@ jobs:
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag
type=ref,event=pr
type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }}

- uses: docker/build-push-action@v6
with:
context: ${{ inputs.context }}
push: ${{ github.event_name != 'pull_request' }}
push: ${{ inputs.push }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Loading