drop docker/* gitea actions to avoid 2+ min git-clone overhead per run
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m6s
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m6s
Gitea's act runner re-clones every referenced GitHub action on every build because it has no action cache. docker/setup-buildx-action alone was taking ~2 minutes to clone before the build even started. buildx is already bundled in gitea/runner-images:ubuntu-latest, so call 'docker buildx build --push' directly with --cache-from/--cache-to pointing at a registry buildcache tag. Keeps the layer caching benefit, skips the action-clone tax entirely.
This commit is contained in:
@@ -14,9 +14,6 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
@@ -24,13 +21,15 @@ jobs:
|
||||
id: meta
|
||||
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ steps.meta.outputs.version }}
|
||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache
|
||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache,mode=max
|
||||
# buildx is already bundled in the gitea/runner-images ubuntu image — no need
|
||||
# for docker/setup-buildx-action, which costs ~2 minutes of git-clone on every run.
|
||||
- name: Build and push with registry cache
|
||||
run: |
|
||||
docker buildx create --use --name ci-builder --driver docker-container || docker buildx use ci-builder
|
||||
docker buildx build \
|
||||
--push \
|
||||
--cache-from "type=registry,ref=$REGISTRY/$IMAGE:buildcache" \
|
||||
--cache-to "type=registry,ref=$REGISTRY/$IMAGE:buildcache,mode=max" \
|
||||
-t "$REGISTRY/$IMAGE:latest" \
|
||||
-t "$REGISTRY/$IMAGE:${{ steps.meta.outputs.version }}" \
|
||||
.
|
||||
|
||||
Reference in New Issue
Block a user