Files
glauth/.github/workflows/docker.yml
T
Jairo Llopis d6ba7d0cbc Bulid and push multiarch docker images (#142)
Fix #141.

With this change, a github action is added that builds a multiarch docker image on every commit, supporting x86_64, aarch64 and arm/v7.

When the action is triggered on a release or tag, it also uploads the versioned image to github container image registry.

Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2020-10-05 23:24:13 +02:00

42 lines
1.7 KiB
YAML

name: docker
on:
pull_request:
push:
branches:
- master
release:
types:
- created
- edited
jobs:
build-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
BUILDX_VERSION: v0.4.1
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- uses: actions/checkout@v2
- name: set up multiarch builder
run: |
set -ex
curl -sSL https://get.docker.com | bash
mkdir -p ~/.docker/cli-plugins
curl -sSLo ~/.docker/cli-plugins/buildx https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-$BUILDX_VERSION.linux-amd64
chmod +x ~/.docker/cli-plugins/buildx
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch
docker buildx use multiarch
docker buildx inspect --bootstrap
curl -sSL https://gist.githubusercontent.com/ArturKlauser/0f0293c62f5626df0261ac994d8a46af/raw/33ef25b8a93f15310f0a4013deca3f8d20fc00a7/check-qemu-binfmt.sh | bash
- name: log in github registry
run: docker login --username "${{ github.actor }}" --password "${{ secrets.GITHUB_TOKEN }}" docker.pkg.github.com
- name: build multiarch images
run: docker buildx build -t docker.pkg.github.com/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):$(echo ${{ github.ref }} | tr / -) --platform linux/amd64,linux/arm64,linux/arm/v7 .
- name: push multiarch images
if: github.event.release.tag_name
run: docker buildx build --push -t docker.pkg.github.com/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ github.event.release.tag_name }} --platform linux/amd64,linux/arm64,linux/arm/v7 .