diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 4751703..ae4ac2e 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -39,8 +39,26 @@ jobs: run: | set -euo pipefail export DOCKER_HOST=unix:///var/run/docker.sock - docker buildx build --push \ - -f Dockerfile \ - -t "$REGISTRY_HOSTPORT/nxtgauge-frontend-solid:${{ gitea.sha }}" \ - -t "$REGISTRY_HOSTPORT/nxtgauge-frontend-solid:high-performance-latest" \ - . + + build_and_push() { + docker buildx build --push \ + -f Dockerfile \ + -t "$REGISTRY_HOSTPORT/nxtgauge-frontend-solid:${{ gitea.sha }}" \ + -t "$REGISTRY_HOSTPORT/nxtgauge-frontend-solid:high-performance-latest" \ + . + } + + for attempt in 1 2 3; do + echo "Build attempt $attempt" + if build_and_push; then + exit 0 + fi + echo "Build attempt $attempt failed; recreating builder and retrying" + docker buildx rm --all-inactive --force || true + docker buildx create --use || true + docker buildx inspect --bootstrap + sleep $((attempt * 10)) + done + + echo "Build failed after retries" + exit 1