d0ebb34432
This commit introduces a huge change in the build process. What changed: - Dockerfile.ldap was integrated into Dockerfile as a seperate [build stage][multistage-build]. - All the build scripts were refactored according to this. - The `docker-compose.yml` file was adjusted likewise. - The main build script, `/build.sh`, now always builds all targets (formerly called variants). - The minimal requirements for Docker and docker-compose have increased. - The build on hub.docker.com must be adjusted. This change should also fix #156 permanently. [multistage-build]: https://docs.docker.com/develop/develop-images/multistage-build/
2.1 KiB
2.1 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
Dockerfile location: Dockerfile
- Source Type: Branch
Source: master
Docker Tag: prerelease
Dockerfile location: Dockerfile
- Source Type: Branch
Source: master
Docker Tag: release
Dockerfile location: Dockerfile
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
. See/hooks/*
. - Shared functionality of the scripts
build
,test
andpush
is extracted to/hooks/common
. - The
build
script runsrun_build()
from/hooks/common
. This triggers either/build-branches.sh
,/build-latest.sh
or directly/build.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 ($DOCKER_TAG
) is only used to select the type (release, prerelease, branches) of the build in hooks/common
.
Because it has a different meaning in all the other build scripts, it is unset
after it has served it's purpose.