Merge pull request #9 from simonrupf/dependabot/docker/alpine-3.21 #47
Workflow file for this run
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
name: Deploy multi-architecture Docker images with buildx | |
on: | |
pull_request: | |
branches: master | |
push: | |
branches: master | |
tags: '*' | |
jobs: | |
buildx: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Prepare | |
id: prepare | |
run: | | |
IMAGE=simonrupf/chronyd | |
QEMU_PLATFORMS=linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x | |
VERSION=${GITHUB_REF##*/} | |
echo "buildx_args=--tag ${IMAGE}:latest \ | |
--tag ${IMAGE}:${VERSION} \ | |
--platform linux/amd64,linux/386,${QEMU_PLATFORMS} ." >> $GITHUB_OUTPUT | |
echo "qemu_platforms=${QEMU_PLATFORMS}" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: ${{ steps.prepare.outputs.qemu_platforms }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
install: true | |
- name: Docker Build | |
run: | | |
docker build --no-cache --pull --output "type=image,push=false" --build-arg BUILD_DATE=$(date -u '+%Y-%m-%dT%H:%M:%S%z') ${{ steps.prepare.outputs.buildx_args }} | |
- name: Docker Login | |
if: success() && github.event_name != 'pull_request' && github.ref != 'refs/heads/master' | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
printenv DOCKER_PASSWORD | docker login --username "${DOCKER_USERNAME}" --password-stdin | |
- name: Docker Push | |
if: success() && github.event_name != 'pull_request' && github.ref != 'refs/heads/master' | |
run: | | |
docker build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} | |
- name: Cleanup | |
if: always() && github.event_name != 'pull_request' && github.ref != 'refs/heads/master' | |
run: | | |
rm -f ${HOME}/.docker/config.json |