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.
36 lines
1.2 KiB
YAML
36 lines
1.2 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
env:
|
|
REGISTRY: git.felixfoertsch.de
|
|
IMAGE: felixfoertsch/netfelix-audio-fix
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
|
|
|
|
- name: Extract version from package.json
|
|
id: meta
|
|
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
|
|
|
|
# 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 }}" \
|
|
.
|