ci: specify platform for image builds #70
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: PR checks | |
on: | |
pull_request: | |
branches: | |
- master | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: applause/strongdm-gateway | |
jobs: | |
Run-CI-Script: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: scripts/ci.sh | |
build-amd64: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
# TEMP workaround | |
# https://github.com/actions-runner-controller/actions-runner-controller/issues/893 | |
- name: Create context | |
run: docker context create builders | |
- uses: docker/setup-buildx-action@v2 | |
with: | |
endpoint: builders | |
- uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-${{ runner.arch }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ runner.arch }}-buildx- | |
- id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: | | |
latest=false | |
suffix=-amd64 | |
- name: build | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
platforms: linux/amd64 | |
# TEMP fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
build-arm64: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
# TEMP workaround | |
# https://github.com/actions-runner-controller/actions-runner-controller/issues/893 | |
- name: Create context | |
run: docker context create builders | |
- uses: docker/setup-buildx-action@v2 | |
with: | |
endpoint: builders | |
- uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-${{ runner.arch }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ runner.arch }}-buildx- | |
- id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: | | |
latest=false | |
suffix=-amr64v8 | |
- name: build | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
platforms: linux/arm64 | |
# TEMP fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |