test gha image caching
Some checks failed
Check / checks (push) Has been cancelled
Release / buildpush (release) Failing after 43s

This commit is contained in:
Gustavo Maronato 2024-03-26 15:38:17 -04:00
parent 28b49fb78f
commit 2336830d37
Signed by: maronato
SSH Key Fingerprint: SHA256:2Gw7kwMz/As+2UkR1qQ/qYYhn+WNh3FGv6ozhoRrLcs

View File

@ -15,9 +15,9 @@ jobs:
- # Get the repository's code - # Get the repository's code
name: Checkout name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- # https://github.com/vegardit/docker-gitea-act-runner/issues/23 # - # https://github.com/vegardit/docker-gitea-act-runner/issues/23
name: Fix docker sock permissions # name: Fix docker sock permissions
run: sudo chmod 666 /var/run/docker.sock # run: sudo chmod 666 /var/run/docker.sock
- # https://github.com/docker/setup-qemu-action - # https://github.com/docker/setup-qemu-action
name: Set up QEMU name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
@ -25,17 +25,17 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- # https://github.com/docker/login-action # - # https://github.com/docker/login-action
name: Log in to the Container registry # name: Log in to the Container registry
uses: docker/login-action@v3 # uses: docker/login-action@v3
with: # with:
# Maybe there is a default env var for this? # # Maybe there is a default env var for this?
registry: git.maronato.dev # registry: git.maronato.dev
username: ${{ github.repository_owner }}} # username: ${{ github.repository_owner }}}
# Ideally, we should only need to set "permissions: package: write", but # # Ideally, we should only need to set "permissions: package: write", but
# Gitea is having issues with that. For now, this is a manually created # # Gitea is having issues with that. For now, this is a manually created
# token available user-wise, with the "package:write" permission. # # token available user-wise, with the "package:write" permission.
password: ${{ secrets.PACKAGE_WRITE_TOKEN }} # password: ${{ secrets.PACKAGE_WRITE_TOKEN }}
- # https://github.com/docker/metadata-action - # https://github.com/docker/metadata-action
# Generate tags and labels for the image # Generate tags and labels for the image
# according to the commit and the branch # according to the commit and the branch
@ -51,18 +51,18 @@ jobs:
type=ref,event=pr type=ref,event=pr
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}
- # httos://github.com/actions/cache # - # httos://github.com/actions/cache
name: Cache Docker layers # name: Cache Docker layers
uses: actions/cache@v4 # uses: actions/cache@v4
with: # with:
path: | # path: |
/go/pkg/mod/ # /go/pkg/mod/
/tmp/.npm-cache # /tmp/.npm-cache
/tmp/.go-build-cache # /tmp/.go-build-cache
/tmp/.buildx-cache # /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }} # key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: | # restore-keys: |
${{ runner.os }}-buildx- # ${{ runner.os }}-buildx-
- # https://github.com/docker/build-push-action - # https://github.com/docker/build-push-action
name: Build and push name: Build and push
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
@ -74,12 +74,14 @@ jobs:
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache # cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max # cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- # Temp fix cache-from: type=gha
# https://github.com/docker/build-push-action/issues/252 cache-to: type=gha,mode=max
# https://github.com/moby/buildkit/issues/1896 # - # Temp fix
name: Move cache # # https://github.com/docker/build-push-action/issues/252
run: | # # https://github.com/moby/buildkit/issues/1896
rm -rf /tmp/.buildx-cache # name: Move cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache # run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache