-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split up docker image building for re-use
- Loading branch information
Showing
2 changed files
with
73 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Docker Image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
tags: | ||
description: "List of image tags (newline separated) for the resulting docker image" | ||
required: true | ||
type: string | ||
push: | ||
description: "If true, the image will be pushed to the registry" | ||
required: false | ||
default: false | ||
type: boolean | ||
platforms: | ||
description: "Comma separated list of platforms to build the image for" | ||
required: false | ||
default: "linux/amd64,linux/arm64" | ||
type: string | ||
context: | ||
description: "Context directory for the docker build" | ||
required: false | ||
default: "." | ||
type: string | ||
build-args: | ||
description: "List of build arguments (newline separated) to be inserted in the docker build" | ||
required: false | ||
default: "" | ||
type: string | ||
file: | ||
description: "Name of the dockerfile to build" | ||
required: false | ||
default: "Dockerfile" | ||
type: string | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | ||
with: | ||
context: "${{ inputs.context }}" | ||
file: "${{ inputs.file }}" | ||
platforms: "${{ inputs.platforms }}" | ||
no-cache: true | ||
pull: true | ||
build-args: "${{ inputs.build-args }}" | ||
push: ${{ inputs.push }} | ||
tags: "${{ inputs.tags }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters