name: docker on: pull_request: branches: - master paths: - .github/workflows/docker.yaml - pkg/** - go.* - Dockerfile - Makefile push: branches: - master paths: - .github/workflows/docker.yaml - pkg/** - go.* - Dockerfile - Makefile tags: - v* jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: docker/metadata-action@v4 id: metadata with: images: ghcr.io/${{ github.repository }} - uses: int128/docker-build-cache-config-action@v1 id: cache with: image: ghcr.io/${{ github.repository }}/cache - uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - uses: docker/setup-qemu-action@v2 - uses: docker/setup-buildx-action@v2 - uses: docker/build-push-action@v3 with: push: ${{ github.event_name == 'push' }} tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }} cache-from: ${{ steps.cache.outputs.cache-from }} cache-to: ${{ steps.cache.outputs.cache-to }} platforms: linux/amd64,linux/arm64