-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from pi-hole/ftl-build/buildx
Use docker buildx for ftl-build containers
- Loading branch information
Showing
14 changed files
with
282 additions
and
1,006 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,35 @@ | ||
name: Login to container registries | ||
description: Login to container registries Docker Hub and GitHub Container Registry | ||
|
||
inputs: | ||
# Actions cannot access secrets so pass them in as inputs | ||
docker_username: | ||
required: true | ||
description: The username to use to login to Docker Hub | ||
docker_password: | ||
required: true | ||
description: The password to use to login to Docker Hub | ||
ghcr_username: | ||
required: true | ||
description: The username to use to login to GitHub Container Registry | ||
ghcr_password: | ||
required: true | ||
description: The password to use to login to GitHub Container Registry | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: docker.io | ||
username: ${{ inputs.docker_username }} | ||
password: ${{ inputs.docker_password }} | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ inputs.ghcr_username }} | ||
password: ${{ inputs.ghcr_password }} |
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,50 @@ | ||
name: Merge and push | ||
description: Apply meta, create manifest, and push to container registry | ||
|
||
inputs: | ||
imagename: | ||
required: true | ||
description: The name of the image to push | ||
platform: | ||
required: true | ||
description: The platform to push the image for | ||
registry: | ||
required: true | ||
description: The Registry to push the image to | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- | ||
name: Docker meta | ||
id: meta_docker | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ inputs.imagename }},enable=${{ github.event_name != 'workflow_dispatch' }} | ||
# We want to tag the image with the latest tag if the workflow was triggered by a tag | ||
flavor: | | ||
latest=${{ startsWith(github.ref, 'refs/tags/') }} | ||
# tags: | ||
# type=schedule means that a tag is applied when the workflow is triggered by a schedule event | ||
# type=ref,event=branch means that a tag is applied when the workflow is triggered by a push to a branch | ||
# type=ref,event=tag means that a tag is applied when the workflow is triggered by a push to a tag | ||
tags: | | ||
type=schedule,suffix=-${{ inputs.platform }},enable=${{ github.event_name == 'schedule' }} | ||
type=ref,event=branch,suffix=-${{ inputs.platform }},enable=${{ github.event_name != 'schedule' }} | ||
type=ref,event=tag,suffix=-${{ inputs.platform }} | ||
- | ||
name: Create manifest list and push to repository | ||
working-directory: /tmp/digests/${{ inputs.registry }}/${{ inputs.platform }} | ||
# When using composite actions, you have to specify the shell. As you | ||
# don’t specify a runner type in composite actions, you need to specify | ||
# the shell instead for each action. | ||
shell: bash | ||
run: | | ||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ inputs.imagename }}@sha256:%s ' *) | ||
- | ||
name: Inspect image | ||
shell: bash | ||
run: | | ||
docker buildx imagetools inspect ${{ inputs.imagename }}:${{ steps.meta_docker.outputs.version }} |
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
Oops, something went wrong.