Fix Docker build retry and apt mirror
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled

This commit is contained in:
zyc 2026-05-27 10:45:57 +08:00
parent 2a6216c706
commit d0b34c664a
2 changed files with 23 additions and 6 deletions

View File

@ -41,19 +41,36 @@ jobs:
id: build_toonflow
run: |
set -o pipefail
BUILD_OK=0
for attempt in 1 2 3; do
echo "Build ToonFlow attempt $attempt/3..."
DOCKER_BUILDKIT=0 docker build \
if DOCKER_BUILDKIT=0 docker build \
--tag ${{ env.CR_SERVER_ACTIVE }}/${{ env.CR_ORG }}/toonflow:${{ env.IMAGE_TAG }} \
--tag ${{ env.CR_SERVER_ACTIVE }}/${{ env.CR_ORG }}/toonflow:latest \
. 2>&1 | tee /tmp/build.log && break
. 2>&1 | tee /tmp/build.log; then
BUILD_OK=1
break
fi
echo "Attempt $attempt failed, retrying in 10s..." && sleep 10
done
if [ "$BUILD_OK" -ne 1 ]; then
echo "Docker build failed after 3 attempts."
exit 1
fi
PUSH_OK=0
for attempt in 1 2 3; do
docker push ${{ env.CR_SERVER_ACTIVE }}/${{ env.CR_ORG }}/toonflow:${{ env.IMAGE_TAG }} && \
docker push ${{ env.CR_SERVER_ACTIVE }}/${{ env.CR_ORG }}/toonflow:latest && break
if docker push ${{ env.CR_SERVER_ACTIVE }}/${{ env.CR_ORG }}/toonflow:${{ env.IMAGE_TAG }} && \
docker push ${{ env.CR_SERVER_ACTIVE }}/${{ env.CR_ORG }}/toonflow:latest; then
PUSH_OK=1
break
fi
echo "Push attempt $attempt failed, retrying in 10s..." && sleep 10
done
if [ "$PUSH_OK" -ne 1 ]; then
echo "Docker push failed after 3 attempts."
exit 1
fi
- name: Setup Kubectl
run: |

View File

@ -3,8 +3,8 @@ FROM node:24-bookworm-slim
WORKDIR /app
RUN sed -i \
-e 's|http://deb.debian.org/debian|https://mirrors.aliyun.com/debian|g' \
-e 's|http://deb.debian.org/debian-security|https://mirrors.aliyun.com/debian-security|g' \
-e 's|http://deb.debian.org/debian|http://mirrors.aliyun.com/debian|g' \
-e 's|http://deb.debian.org/debian-security|http://mirrors.aliyun.com/debian-security|g' \
/etc/apt/sources.list.d/debian.sources && \
apt-get update && \
apt-get install -y --no-install-recommends ca-certificates python3 make g++ && \