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:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
|
||||||
|
|
||||||
@@ -24,13 +21,15 @@ jobs:
|
|||||||
id: meta
|
id: meta
|
||||||
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
|
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Build and push
|
# buildx is already bundled in the gitea/runner-images ubuntu image — no need
|
||||||
uses: docker/build-push-action@v6
|
# for docker/setup-buildx-action, which costs ~2 minutes of git-clone on every run.
|
||||||
with:
|
- name: Build and push with registry cache
|
||||||
context: .
|
run: |
|
||||||
push: true
|
docker buildx create --use --name ci-builder --driver docker-container || docker buildx use ci-builder
|
||||||
tags: |
|
docker buildx build \
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
--push \
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ steps.meta.outputs.version }}
|
--cache-from "type=registry,ref=$REGISTRY/$IMAGE:buildcache" \
|
||||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache
|
--cache-to "type=registry,ref=$REGISTRY/$IMAGE:buildcache,mode=max" \
|
||||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache,mode=max
|
-t "$REGISTRY/$IMAGE:latest" \
|
||||||
|
-t "$REGISTRY/$IMAGE:${{ steps.meta.outputs.version }}" \
|
||||||
|
.
|
||||||
|
|||||||
Reference in New Issue
Block a user