Skip to content

Commit a24c19c

Browse files
committed
Use Docker Build Cloud for releases
With QEMU the ARM64 builds are slow and not reliable. If we use the Docker Cloud builders we reduce the build times considerably. As a Docker OSS organisation we get 400 build minutes per month, which should be fine, because we already use checks if builds are really needed. The Docker Cloud also uses a cache that should reduce build times a little bit more.
1 parent f13a6bf commit a24c19c

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- ./build.sh feature
2020
- ./build.sh develop
2121
platform:
22-
- linux/amd64
22+
- linux/amd64,linux/arm64
2323
fail-fast: false
2424
runs-on: ubuntu-latest
2525
name: Builds new NetBox Docker Images
@@ -35,19 +35,11 @@ jobs:
3535
name: Get Version of NetBox Docker
3636
run: echo "version=$(cat VERSION)" >>"$GITHUB_OUTPUT"
3737
shell: bash
38-
- id: qemu-setup
39-
name: Set up QEMU
40-
uses: docker/setup-qemu-action@v3
41-
- id: buildx-setup
42-
name: Set up Docker Buildx
43-
uses: docker/setup-buildx-action@v3
44-
- id: docker-build
45-
name: Build the image with '${{ matrix.build_cmd }}'
38+
- id: check-build-needed
39+
name: Check if the build is needed for '${{ matrix.build_cmd }}'
40+
env:
41+
CHECK_ONLY: "true"
4642
run: ${{ matrix.build_cmd }}
47-
- id: test-image
48-
name: Test the image
49-
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
50-
if: steps.docker-build.outputs.skipped != 'true'
5143
# docker.io
5244
- id: docker-io-login
5345
name: Login to docker.io
@@ -56,7 +48,14 @@ jobs:
5648
registry: docker.io
5749
username: ${{ secrets.dockerhub_username }}
5850
password: ${{ secrets.dockerhub_password }}
59-
if: steps.docker-build.outputs.skipped != 'true'
51+
if: steps.check-build-needed.outputs.skipped != 'true'
52+
- id: buildx-setup
53+
name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
with:
56+
version: "lab:latest"
57+
driver: cloud
58+
endpoint: "netboxcommunity/netbox-default"
6059
# quay.io
6160
- id: quay-io-login
6261
name: Login to Quay.io
@@ -65,7 +64,7 @@ jobs:
6564
registry: quay.io
6665
username: ${{ secrets.quayio_username }}
6766
password: ${{ secrets.quayio_password }}
68-
if: steps.docker-build.outputs.skipped != 'true'
67+
if: steps.check-build-needed.outputs.skipped != 'true'
6968
# ghcr.io
7069
- id: ghcr-io-login
7170
name: Login to GitHub Container Registry
@@ -74,11 +73,11 @@ jobs:
7473
registry: ghcr.io
7574
username: ${{ github.repository_owner }}
7675
password: ${{ secrets.GITHUB_TOKEN }}
77-
if: steps.docker-build.outputs.skipped != 'true'
76+
if: steps.check-build-needed.outputs.skipped != 'true'
7877
- id: build-and-push
7978
name: Push the image
8079
run: ${{ matrix.build_cmd }} --push
81-
if: steps.docker-build.outputs.skipped != 'true'
80+
if: steps.check-build-needed.outputs.skipped != 'true'
8281
env:
8382
BUILDX_PLATFORM: ${{ matrix.platform }}
8483
BUILDX_BUILDER_NAME: ${{ steps.buildx-setup.outputs.name }}

build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ GH_ACTION If defined, special 'echo' statements are enabled that set the
103103
- FINAL_DOCKER_TAG: The final value of the DOCKER_TAG env variable
104104
${_GREEN}Default:${_CLEAR} undefined
105105
106+
CHECK_ONLY Only checks if the build is needed and sets the GH Action output.
107+
106108
${_BOLD}Examples:${_CLEAR}
107109
108110
${0} master
@@ -355,6 +357,11 @@ else
355357
fi
356358
gh_echo "::endgroup::"
357359

360+
if [ "${CHECK_ONLY}" = "true" ]; then
361+
echo "Only check if build needed was requested. Exiting"
362+
exit 0
363+
fi
364+
358365
###
359366
# Build the image
360367
###

0 commit comments

Comments
 (0)