Skip to content

Commit cf83f60

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 5e002d0 + a26dccb commit cf83f60

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

.github/workflows/dockercontainer-build.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,25 @@ jobs:
2929
docker-compose --file docker-compose.test.yml build
3030
docker-compose --file docker-compose.test.yml run sut
3131
else
32-
docker buildx build . --file Dockerfile --platform linux/amd64,linux/arm64
32+
# Add retry logic for docker buildx
33+
max_attempts=3
34+
attempt=1
35+
while [ $attempt -le $max_attempts ]; do
36+
echo "Attempt $attempt of $max_attempts for docker buildx build"
37+
if docker buildx build . --file Dockerfile --platform linux/amd64; then
38+
echo "Build successful!"
39+
break
40+
else
41+
echo "Build failed on attempt $attempt"
42+
if [ $attempt -eq $max_attempts ]; then
43+
echo "All attempts failed. Exiting."
44+
exit 1
45+
fi
46+
echo "Waiting 30 seconds before retrying..."
47+
sleep 30
48+
((attempt++))
49+
fi
50+
done
3351
fi
3452
# Push image to GitHub Packages.
3553
# See also https://docs.docker.com/docker-hub/builds/
@@ -61,9 +79,26 @@ jobs:
6179
echo IMAGE_ID=$IMAGE_ID
6280
echo VERSION=$VERSION
6381
64-
# Build and push multi-arch image
65-
docker buildx build . \
66-
--platform linux/amd64,linux/arm64 \
67-
--file Dockerfile \
68-
--tag $IMAGE_ID:$VERSION \
69-
--push
82+
# Build and push with retry logic
83+
max_attempts=3
84+
attempt=1
85+
while [ $attempt -le $max_attempts ]; do
86+
echo "Attempt $attempt of $max_attempts for docker buildx build and push"
87+
if docker buildx build . \
88+
--platform linux/amd64,linux/arm64 \
89+
--file Dockerfile \
90+
--tag $IMAGE_ID:$VERSION \
91+
--push; then
92+
echo "Build and push successful!"
93+
break
94+
else
95+
echo "Build and push failed on attempt $attempt"
96+
if [ $attempt -eq $max_attempts ]; then
97+
echo "All attempts failed. Exiting."
98+
exit 1
99+
fi
100+
echo "Waiting 30 seconds before retrying..."
101+
sleep 30
102+
((attempt++))
103+
fi
104+
done

0 commit comments

Comments
 (0)