Use a ghaction matrix in docker build

to build each architecture individually
This commit is contained in:
Viktor Strate Kløvedal
2021-03-28 19:39:22 +02:00
committed by GitHub
parent e29beea1ff
commit 3224cc8ce7

View File

@@ -1,8 +1,5 @@
name: Docker builds
env:
TARGET_PLATFORMS: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
on:
schedule:
- cron: "0 10 * * *" # everyday at 10am
@@ -17,6 +14,15 @@ jobs:
build:
name: Build and deploy docker images
runs-on: ubuntu-20.04
strategy:
matrix:
target_platform:
- "linux/amd64"
- "linux/arm/v6"
- "linux/arm/v7"
- "linux/arm64"
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -26,14 +32,14 @@ jobs:
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}-${{ github.sha }}
key: ${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}-${{ matrix.target_platform }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}-
${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}-${{ matrix.target_platform }}-
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: ${{ env.TARGET_PLATFORMS }}
platforms: ${{ matrix.target_platform }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
@@ -43,7 +49,7 @@ jobs:
run: |
DOCKER_USERNAME=viktorstrate
DOCKER_IMAGE=viktorstrate/photoview
DOCKER_PLATFORMS=${TARGET_PLATFORMS}
DOCKER_PLATFORMS=${{ matrix.target_platform }}
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then