Update flaskr-ci.yaml

This commit is contained in:
Ted Spinks 2023-02-21 20:08:40 -05:00 committed by GitHub
parent 8b4eb481a9
commit d586f7c557
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,21 +37,23 @@ jobs:
# Required permission to push images with the built-in GITHUB_TOKEN
packages: write
runs-on: ubuntu-latest
env:
CACHE: "${{ runner.temp }}/.buildx-cache"
NEW_CACHE: "${{ runner.temp }}/.buildx-cache-new"
steps:
- uses: actions/checkout@v3
- name: Set job vars
- name: Job vars and prep
id: vars
run: |
echo "SHA_SHORT=${GITHUB_SHA:0:10}" >> ${GITHUB_ENV}
echo "REPO_LOWER_CASE=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
# This is a separate action that sets up buildx runner
- name: Set up Docker Buildx
mkdir -p ${CACHE}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
# So now you can use Actions' own caching!
- name: Cache Docker layers
- name: Setup cache for Docker Buildx
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
path: ${{ env.CACHE }}
key: flaskr-buildx-${{ github.ref_name }}
restore-keys: |
flaskr-buildx-main
@ -68,8 +70,8 @@ jobs:
push: true
# tags: "ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.sha_short }}"
tags: "ghcr.io/${{ env.REPO_LOWER_CASE }}:${{ env.SHA_SHORT }}"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
cache-from: type=local,src=${{ env.CACHE }}
cache-to: type=local,dest=${{ env.NEW_CACHE }}
# This ugly bit is necessary if you don't want your cache to grow forever
# until it hits GitHub's limit of 5GB.
# Temp fix
@ -77,5 +79,5 @@ jobs:
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
rm -rf $CACHE
mv $NEW_CACHE $CACHE