Skip to content

Commit 293be68

Browse files
committed
retry on docker build in action
1 parent 57aaec3 commit 293be68

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

.github/workflows/docker.dispatch.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ jobs:
2929
MYAPP_VERSION=$(git rev-parse --short HEAD)
3030
docker buildx create --name mybuilder --driver docker-container --bootstrap --use
3131
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
32-
docker buildx build --platform linux/amd64,linux/arm64 --build-arg BUILD_NAME=myapp --build-arg MYAPP_VERSION=${MYAPP_VERSION} --build-arg UPGRADE_REQS="yes" --no-cache -t docker.io/mpgagebioinformatics/myapp:latest -f services/server/Dockerfile --push .
32+
for i in {1..3}; do
33+
docker buildx build --platform linux/amd64,linux/arm64 --build-arg BUILD_NAME=myapp --build-arg MYAPP_VERSION=${MYAPP_VERSION} --build-arg UPGRADE_REQS="yes" --no-cache -t docker.io/mpgagebioinformatics/myapp:latest -f services/server/Dockerfile --push . && break
34+
echo "Build failed (attempt $i). Retrying in 30s..."
35+
sleep 30
36+
done
3337
- name: Set Success env
3438
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-8)" >> $GITHUB_ENV
3539
- name: Slack Success Notification

.github/workflows/docker.latest.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ jobs:
3232
run: |
3333
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
3434
MYAPP_VERSION=$(git rev-parse --short HEAD)
35-
docker buildx build --platform linux/amd64,linux/arm64 --build-arg BUILD_NAME=myapp --build-arg MYAPP_VERSION=${MYAPP_VERSION} --build-arg UPGRADE_REQS="yes" --no-cache -t docker.io/mpgagebioinformatics/myapp:latest -f services/server/Dockerfile --push .
35+
for i in {1..3}; do
36+
docker buildx build --platform linux/amd64,linux/arm64 --build-arg BUILD_NAME=myapp --build-arg MYAPP_VERSION=${MYAPP_VERSION} --build-arg UPGRADE_REQS="yes" --no-cache -t docker.io/mpgagebioinformatics/myapp:latest -f services/server/Dockerfile --push . && break
37+
echo "Build failed (attempt $i). Retrying in 30s..."
38+
sleep 30
39+
done
3640
- name: Set Success env
3741
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-8)" >> $GITHUB_ENV
3842
- name: Slack Success Notification

.github/workflows/docker.nightly.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ jobs:
3131
MYAPP_VERSION=$(git rev-parse --short HEAD)
3232
docker buildx create --name mybuilder --driver docker-container --bootstrap --use
3333
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
34-
docker buildx build --platform linux/amd64,linux/arm64 --build-arg BUILD_NAME=myapp --build-arg MYAPP_VERSION=${MYAPP_VERSION} --build-arg UPGRADE_REQS="yes" --no-cache -t docker.io/mpgagebioinformatics/myapp:nightly -f services/server/Dockerfile --push .
34+
for i in {1..3}; do
35+
docker buildx build --platform linux/amd64,linux/arm64 --build-arg BUILD_NAME=myapp --build-arg MYAPP_VERSION=${MYAPP_VERSION} --build-arg UPGRADE_REQS="yes" --no-cache -t docker.io/mpgagebioinformatics/myapp:nightly -f services/server/Dockerfile --push . && break
36+
echo "Build failed (attempt $i). Retrying in 30s..."
37+
sleep 30
38+
done
3539
- name: Set Success env
3640
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-8)" >> $GITHUB_ENV
3741
- name: Slack Success Notification

.github/workflows/docker.tag.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ jobs:
3434
git checkout ${MYAPP_VERSION}
3535
docker buildx create --name mybuilder --driver docker-container --bootstrap --use
3636
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
37-
docker buildx build --platform linux/amd64,linux/arm64 --build-arg BUILD_NAME=myapp --build-arg MYAPP_VERSION=${MYAPP_VERSION} --no-cache -t docker.io/mpgagebioinformatics/myapp:stable -t docker.io/mpgagebioinformatics/myapp:latest -t docker.io/mpgagebioinformatics/myapp:${MYAPP_VERSION} -f services/server/Dockerfile --push .
37+
for i in {1..3}; do
38+
docker buildx build --platform linux/amd64,linux/arm64 --build-arg BUILD_NAME=myapp --build-arg MYAPP_VERSION=${MYAPP_VERSION} --no-cache -t docker.io/mpgagebioinformatics/myapp:stable -t docker.io/mpgagebioinformatics/myapp:latest -t docker.io/mpgagebioinformatics/myapp:${MYAPP_VERSION} -f services/server/Dockerfile --push . && break
39+
echo "Build failed (attempt $i). Retrying in 30s..."
40+
sleep 30
41+
done
3842
- name: Set Success env
3943
run: echo "GITHUB_SHA_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
4044
- name: Slack Success Notification

0 commit comments

Comments
 (0)