Skip to content

trying to deconflict cache collision #41

trying to deconflict cache collision

trying to deconflict cache collision #41

Workflow file for this run

name: build and push containers to GHCR.io
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
directory: [ api, cli ]
platform: [ linux/amd64, linux/arm64 ]
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: setup docker buildx
uses: docker/setup-buildx-action@v3
# with:
# buildkitd-flags: --debug
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
logout: false
# - name: Create a variable with platform '${{ matrix.platform }}' value
# run: echo "PLATFORM=${{ matrix.platform }}" >> $GITHUB_ENV
# - name: Swap / for - in '${{ matrix.platform }}' and create local_platform variable
# id: local_platform
# run: |
# LOCAL_PLATFORM="${PLATFORM//\/\-}"
# echo "LOCAL_PLATFORM=${LOCAL_PLATFORM}" >> $GITHUB_ENV
# echo "::set-output name=local_platform::${LOCAL_PLATFORM}"
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ github.run_number }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.directory }}
push: true
tags: ghcr.io/${{ github.repository_owner }}/hamframe-${{ matrix.directory }}:latest
platforms: ${{ matrix.platform }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache