diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 2efce69..615f7d6 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -73,27 +73,24 @@ jobs: run: | set -euo pipefail - # Build via docker (uses dind via DOCKER_HOST) - docker build --pull \ - -t "${REGISTRY}/${IMAGE}:${VERSION}" \ - . - - # Save image to OCI archive — this exports the layers to a tarball - # that skopeo can read directly, bypassing the docker socket + docker build --pull -t "${REGISTRY}/${IMAGE}:${VERSION}" . docker save "${REGISTRY}/${IMAGE}:${VERSION}" -o /tmp/image.tar - # Push with skopeo from the archive - skopeo copy --dest-creds "$REG_USER:$REG_PASS" \ + # Pre-authenticate via skopeo login so it caches the basic-auth header + # in /run/containers/0/auth.json. Then copy with no creds — uses cache. + mkdir -p /run/containers/0 + skopeo login \ + --username "$REG_USER" \ + --password "$REG_PASS" \ + "${REGISTRY}" + + skopeo copy \ "docker-archive:/tmp/image.tar" \ "docker://${REGISTRY}/${IMAGE}:${VERSION}" - # Tag latest by copying within the registry (no rebuild needed) skopeo copy \ - --src-creds "$REG_USER:$REG_PASS" \ - --dest-creds "$REG_USER:$REG_PASS" \ "docker://${REGISTRY}/${IMAGE}:${VERSION}" \ "docker://${REGISTRY}/${IMAGE}:latest" - - name: Tag git commit with version env: VERSION: ${{ steps.version.outputs.version }}