Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Replace buildx cache with standard registry
Browse files Browse the repository at this point in the history
This is more consistent with the other repos and allows more caching
options
  • Loading branch information
Colin Saliceti committed Jul 28, 2021
1 parent 6458149 commit 35a5ba5
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/build.yml
Expand Up @@ -27,17 +27,8 @@ jobs:
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2.1.6
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set Environment Variables (Push)
if: github.event_name == 'push'
run: |
Expand All @@ -56,6 +47,21 @@ jobs:
# This is the latest commit on the actual PR branch
echo "DOCKER_IMAGE_TAG=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- name: Build Docker Image - base-image target
uses: docker/build-push-action@v2
with:
tags: |
${{ env.DOCKER_IMAGE}}:base-image-${{ env.BRANCH_TAG }}
push: ${{ github.actor != 'dependabot[bot]' }}
load: ${{ github.actor == 'dependabot[bot]' }}
target: base-image
cache-from: |
${{ env.DOCKER_IMAGE}}:base-image-${{ env.BRANCH_TAG }}
${{ env.DOCKER_IMAGE}}:base-image-master
build-args: |
BUILDKIT_INLINE_CACHE=1
COMMIT_SHA=${{ env.DOCKER_IMAGE_TAG}}
- name: Build Docker Image
uses: docker/build-push-action@v2
with:
Expand All @@ -64,10 +70,13 @@ jobs:
${{ env.DOCKER_IMAGE}}:${{ env.BRANCH_TAG }}
push: ${{ github.actor != 'dependabot[bot]' }}
load: ${{ github.actor == 'dependabot[bot]' }}
builder: ${{ steps.buildx.outputs.name }}
cache-to: type=local,dest=/tmp/.buildx-cache
cache-from: type=local,src=/tmp/.buildx-cache
build-args: COMMIT_SHA=${{ env.DOCKER_IMAGE_TAG}}
cache-from: |
${{ env.DOCKER_IMAGE}}:${{ env.BRANCH_TAG }}
${{ env.DOCKER_IMAGE}}:master
${{ env.DOCKER_IMAGE}}:base-image-${{ env.BRANCH_TAG }}
build-args: |
BUILDKIT_INLINE_CACHE=1
COMMIT_SHA=${{ env.DOCKER_IMAGE_TAG}}
- name: Pull image if not loaded
if: ${{ github.actor != 'dependabot[bot]' }}
Expand Down

0 comments on commit 35a5ba5

Please sign in to comment.