mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2024-11-28 10:54:17 +01:00
2.4 KiB
2.4 KiB
cloud.docker.com Configuration
The automatic build is configured in cloud.docker.com.
The following build configuration is expected:
Source Repository: github.com/netbox-community/netbox-docker
Build Location: Build on Docker Hub's infrastructure
Autotest: Internal and External Pull Requests
Repository Links: Enable for Base Image
Build Rules:
- Source Type: Branch
Source: master
Docker Tag: branches-main
Dockerfile location: Dockerfile
- Source Type: Branch
Source: master
Docker Tag: branches-ldap
Dockerfile location: Dockerfile.ldap
- Source Type: Branch
Source: master
Docker Tag: prerelease-main
Dockerfile location: Dockerfile
- Source Type: Branch
Source: master
Docker Tag: prerelease-ldap
Dockerfile location: Dockerfile.ldap
- Source Type: Branch
Source: master
Docker Tag: release-main
Dockerfile location: Dockerfile
- Source Type: Branch
Source: master
Docker Tag: release-ldap
Dockerfile location: Dockerfile.ldap
Build Environment Variables:
# Create an app on Github and use it's OATH credentials here
- Key: GITHUB_OAUTH_CLIENT_ID
Value: <secret>
- Key: GITHUB_OAUTH_CLIENT_SECRET
Value: <secret>
Build Triggers:
- Name: Cron Trigger
# Use this trigger in combination with e.g. https://cron-job.org in order to regularly schedule builds
Background Knowledge
The build system of cloud.docker.com is not made for this kind of project. But we found a way to make it work, and this is how:
- The docker hub build system allows to overwrite the scripts that get executed
for
build
,test
andpush
. Seehooks/*
. - Shared functionality of the scripts
build
,test
andpush
is extracted tohooks/common
. - The
build
script runsrun_build()
fromhooks/common
. This triggers eitherbuild-branches.sh
,build-latest.sh
or directlybuild.sh
. - The
test
script just invokesdocker-compose
commands. - The
push
script runsrun_build()
fromhooks/common
with a--push-only
flag. This causes thebuild.sh
script to not re-build the Docker image, but just the just built image.
The Docker Tag configuration setting is misused to select the type (release, prerelease, branches) of the build as well as the variant (main, ldap).
The Dockerfile location configuration setting is completely ignored by the build scripts.