mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2024-11-07 08:34:00 +01:00
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.
This commit is contained in:
parent
f13a6bf5e4
commit
a24c19c503
33
.github/workflows/release.yml
vendored
33
.github/workflows/release.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
|||||||
- ./build.sh feature
|
- ./build.sh feature
|
||||||
- ./build.sh develop
|
- ./build.sh develop
|
||||||
platform:
|
platform:
|
||||||
- linux/amd64
|
- linux/amd64,linux/arm64
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Builds new NetBox Docker Images
|
name: Builds new NetBox Docker Images
|
||||||
@ -35,19 +35,11 @@ jobs:
|
|||||||
name: Get Version of NetBox Docker
|
name: Get Version of NetBox Docker
|
||||||
run: echo "version=$(cat VERSION)" >>"$GITHUB_OUTPUT"
|
run: echo "version=$(cat VERSION)" >>"$GITHUB_OUTPUT"
|
||||||
shell: bash
|
shell: bash
|
||||||
- id: qemu-setup
|
- id: check-build-needed
|
||||||
name: Set up QEMU
|
name: Check if the build is needed for '${{ matrix.build_cmd }}'
|
||||||
uses: docker/setup-qemu-action@v3
|
env:
|
||||||
- id: buildx-setup
|
CHECK_ONLY: "true"
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- id: docker-build
|
|
||||||
name: Build the image with '${{ matrix.build_cmd }}'
|
|
||||||
run: ${{ matrix.build_cmd }}
|
run: ${{ matrix.build_cmd }}
|
||||||
- id: test-image
|
|
||||||
name: Test the image
|
|
||||||
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
|
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
|
||||||
# docker.io
|
# docker.io
|
||||||
- id: docker-io-login
|
- id: docker-io-login
|
||||||
name: Login to docker.io
|
name: Login to docker.io
|
||||||
@ -56,7 +48,14 @@ jobs:
|
|||||||
registry: docker.io
|
registry: docker.io
|
||||||
username: ${{ secrets.dockerhub_username }}
|
username: ${{ secrets.dockerhub_username }}
|
||||||
password: ${{ secrets.dockerhub_password }}
|
password: ${{ secrets.dockerhub_password }}
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.check-build-needed.outputs.skipped != 'true'
|
||||||
|
- id: buildx-setup
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: "lab:latest"
|
||||||
|
driver: cloud
|
||||||
|
endpoint: "netboxcommunity/netbox-default"
|
||||||
# quay.io
|
# quay.io
|
||||||
- id: quay-io-login
|
- id: quay-io-login
|
||||||
name: Login to Quay.io
|
name: Login to Quay.io
|
||||||
@ -65,7 +64,7 @@ jobs:
|
|||||||
registry: quay.io
|
registry: quay.io
|
||||||
username: ${{ secrets.quayio_username }}
|
username: ${{ secrets.quayio_username }}
|
||||||
password: ${{ secrets.quayio_password }}
|
password: ${{ secrets.quayio_password }}
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.check-build-needed.outputs.skipped != 'true'
|
||||||
# ghcr.io
|
# ghcr.io
|
||||||
- id: ghcr-io-login
|
- id: ghcr-io-login
|
||||||
name: Login to GitHub Container Registry
|
name: Login to GitHub Container Registry
|
||||||
@ -74,11 +73,11 @@ jobs:
|
|||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.check-build-needed.outputs.skipped != 'true'
|
||||||
- id: build-and-push
|
- id: build-and-push
|
||||||
name: Push the image
|
name: Push the image
|
||||||
run: ${{ matrix.build_cmd }} --push
|
run: ${{ matrix.build_cmd }} --push
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.check-build-needed.outputs.skipped != 'true'
|
||||||
env:
|
env:
|
||||||
BUILDX_PLATFORM: ${{ matrix.platform }}
|
BUILDX_PLATFORM: ${{ matrix.platform }}
|
||||||
BUILDX_BUILDER_NAME: ${{ steps.buildx-setup.outputs.name }}
|
BUILDX_BUILDER_NAME: ${{ steps.buildx-setup.outputs.name }}
|
||||||
|
7
build.sh
7
build.sh
@ -103,6 +103,8 @@ GH_ACTION If defined, special 'echo' statements are enabled that set the
|
|||||||
- FINAL_DOCKER_TAG: The final value of the DOCKER_TAG env variable
|
- FINAL_DOCKER_TAG: The final value of the DOCKER_TAG env variable
|
||||||
${_GREEN}Default:${_CLEAR} undefined
|
${_GREEN}Default:${_CLEAR} undefined
|
||||||
|
|
||||||
|
CHECK_ONLY Only checks if the build is needed and sets the GH Action output.
|
||||||
|
|
||||||
${_BOLD}Examples:${_CLEAR}
|
${_BOLD}Examples:${_CLEAR}
|
||||||
|
|
||||||
${0} master
|
${0} master
|
||||||
@ -355,6 +357,11 @@ else
|
|||||||
fi
|
fi
|
||||||
gh_echo "::endgroup::"
|
gh_echo "::endgroup::"
|
||||||
|
|
||||||
|
if [ "${CHECK_ONLY}" = "true" ]; then
|
||||||
|
echo "Only check if build needed was requested. Exiting"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
###
|
###
|
||||||
# Build the image
|
# Build the image
|
||||||
###
|
###
|
||||||
|
Loading…
Reference in New Issue
Block a user