commit
b0b20aa6ba
|
@ -48,7 +48,7 @@ The output of `git rev-parse HEAD`: `XXXXX`
|
||||||
The command you used to start the project: `XXXXX`
|
The command you used to start the project: `XXXXX`
|
||||||
|
|
||||||
<!-- adjust the `latest` tag to the version you're using -->
|
<!-- adjust the `latest` tag to the version you're using -->
|
||||||
The output of `docker inspect netboxcommunity/netbox:latest --format "{{json .ContainerConfig.Labels}}"`:
|
The output of `docker inspect netboxcommunity/netbox:latest --format "{{json .Config.Labels}}"`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!--
|
<!--
|
||||||
###############################################################################
|
#########################################################################
|
||||||
|
|
||||||
Thank you for sharing your work and for opening a PR.
|
Thank you for sharing your work and for opening a PR.
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ First make sure that you point your PR to the `develop` branch!
|
||||||
Now please read the comments carefully and try to provide information
|
Now please read the comments carefully and try to provide information
|
||||||
on all relevant titles.
|
on all relevant titles.
|
||||||
|
|
||||||
###############################################################################
|
#########################################################################
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Please don't open an extra issue when submiting a PR.
|
Please don't open an extra issue when submitting a PR.
|
||||||
|
|
||||||
But if there is already a related issue, please put it's number here.
|
But if there is already a related issue, please put it's number here.
|
||||||
|
|
||||||
|
@ -81,5 +81,5 @@ Please put an x into the brackets (like `[x]`) if you've completed that task.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
* [ ] I have read the comments and followed the PR template.
|
* [ ] I have read the comments and followed the PR template.
|
||||||
* [ ] I have provided and explained my PR according to the information in the comments.
|
* [ ] I have explained my PR according to the information in the comments.
|
||||||
* [ ] My PR targets the `develop` branch.
|
* [ ] My PR targets the `develop` branch.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
name: push
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
|
@ -15,7 +17,7 @@ jobs:
|
||||||
- '' # use the default of the DOCKERFILE
|
- '' # use the default of the DOCKERFILE
|
||||||
- python:3.7-alpine
|
- python:3.7-alpine
|
||||||
- python:3.8-alpine
|
- python:3.8-alpine
|
||||||
- python:3.9-rc-alpine
|
# - python:3.9-rc-alpine # disable until Netbox's unit tests work
|
||||||
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
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
name: release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
# cloud.docker.com Configuration
|
|
||||||
|
|
||||||
The automatic build is configured in cloud.docker.com.
|
|
||||||
|
|
||||||
The following build configuration is expected:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
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: release
|
|
||||||
Docker Tag: branches
|
|
||||||
Dockerfile location: Dockerfile
|
|
||||||
Build Context: /
|
|
||||||
Autobuild: on
|
|
||||||
Build Caching: on
|
|
||||||
- Source Type: Branch
|
|
||||||
Source: release
|
|
||||||
Docker Tag: prerelease
|
|
||||||
Dockerfile location: Dockerfile
|
|
||||||
Build Context: /
|
|
||||||
Autobuild: on
|
|
||||||
Build Caching: on
|
|
||||||
- Source Type: Branch
|
|
||||||
Source: release
|
|
||||||
Docker Tag: release
|
|
||||||
Dockerfile location: Dockerfile
|
|
||||||
Build Context: /
|
|
||||||
Autobuild: on
|
|
||||||
Build Caching: on
|
|
||||||
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
|
|
||||||
Trigger URL: <generated>
|
|
||||||
# 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:
|
|
||||||
|
|
||||||
1. The docker hub build system [allows to overwrite the scripts that get executed
|
|
||||||
for `build`, `test` and `push`](overwrite). See `/hooks/*`.
|
|
||||||
2. Shared functionality of the scripts `build`, `test` and `push` is extracted to `/hooks/common`.
|
|
||||||
3. The `build` script runs `run_build()` from `/hooks/common`.
|
|
||||||
This triggers either `/build-branches.sh`, `/build-latest.sh` or directly `/build.sh`.
|
|
||||||
4. The `test` script just invokes `docker-compose` commands.
|
|
||||||
5. The `push` script runs `run_build()` from `hooks/common` with a `--push-only` flag.
|
|
||||||
This causes the `build.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.
|
|
||||||
|
|
||||||
[overwrite]: https://docs.docker.com/docker-hub/builds/advanced/#override-build-test-or-push-commands
|
|
23
README.md
23
README.md
|
@ -3,7 +3,7 @@
|
||||||
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/netbox-community/netbox-docker)][github-release]
|
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/netbox-community/netbox-docker)][github-release]
|
||||||
[![GitHub stars](https://img.shields.io/github/stars/netbox-community/netbox-docker)][github-stargazers]
|
[![GitHub stars](https://img.shields.io/github/stars/netbox-community/netbox-docker)][github-stargazers]
|
||||||
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed-raw/netbox-community/netbox-docker)
|
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed-raw/netbox-community/netbox-docker)
|
||||||
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/netboxcommunity/netbox)
|
![Github release workflow](https://img.shields.io/github/workflow/status/netbox-community/netbox-docker/release)
|
||||||
![Docker Pulls](https://img.shields.io/docker/pulls/netboxcommunity/netbox)
|
![Docker Pulls](https://img.shields.io/docker/pulls/netboxcommunity/netbox)
|
||||||
[![MicroBadger Layers](https://img.shields.io/microbadger/layers/netboxcommunity/netbox)][netbox-docker-microbadger]
|
[![MicroBadger Layers](https://img.shields.io/microbadger/layers/netboxcommunity/netbox)][netbox-docker-microbadger]
|
||||||
[![MicroBadger Size](https://img.shields.io/microbadger/image-size/netboxcommunity/netbox)][netbox-docker-microbadger]
|
[![MicroBadger Size](https://img.shields.io/microbadger/image-size/netboxcommunity/netbox)][netbox-docker-microbadger]
|
||||||
|
@ -21,7 +21,7 @@ Do you have any questions? Before opening an issue on Github, please join the [N
|
||||||
[netbox-docker-github]: https://github.com/netbox-community/netbox-docker/
|
[netbox-docker-github]: https://github.com/netbox-community/netbox-docker/
|
||||||
[ntc-slack]: http://slack.networktocode.com/
|
[ntc-slack]: http://slack.networktocode.com/
|
||||||
[netbox-docker-slack]: https://slack.com/app_redirect?channel=netbox-docker&team=T09LQ7E9E
|
[netbox-docker-slack]: https://slack.com/app_redirect?channel=netbox-docker&team=T09LQ7E9E
|
||||||
[netbox-docker-license]: https://github.com/netbox-community/netbox-docker/blob/master/LICENSE
|
[netbox-docker-license]: https://github.com/netbox-community/netbox-docker/blob/release/LICENSE
|
||||||
|
|
||||||
## Docker Tags
|
## Docker Tags
|
||||||
|
|
||||||
|
@ -124,31 +124,34 @@ docker-compose up -d
|
||||||
|
|
||||||
From time to time it might become necessary to re-engineer the structure of this setup.
|
From time to time it might become necessary to re-engineer the structure of this setup.
|
||||||
Things like the `docker-compose.yml` file or your Kubernetes or OpenShift configurations have to be adjusted as a consequence.
|
Things like the `docker-compose.yml` file or your Kubernetes or OpenShift configurations have to be adjusted as a consequence.
|
||||||
|
|
||||||
Since November 2019 each image built from this repo contains a `org.opencontainers.image.version` label.
|
Since November 2019 each image built from this repo contains a `org.opencontainers.image.version` label.
|
||||||
(The images contained labels since April 2018, although in November 2019 the labels' names changed.)
|
(The images contained labels since April 2018, although in November 2019 the labels' names changed.)
|
||||||
You can check the label of your local image by running `docker inspect netboxcommunity/netbox:v2.7.1 --format "{{json .ContainerConfig.Labels}}"`.
|
You can check the label of your local image by running `docker inspect netboxcommunity/netbox:v2.7.1 --format "{{json .Config.Labels}}"`.
|
||||||
|
|
||||||
Please read [the release notes][releases] carefully when updating to a new image version.
|
Please read [the release notes][releases] carefully when updating to a new image version.
|
||||||
|
|
||||||
[releases]: https://github.com/netbox-community/netbox-docker/releases
|
[releases]: https://github.com/netbox-community/netbox-docker/releases
|
||||||
|
|
||||||
## Rebuilding & Publishing images
|
## Rebuilding the Image
|
||||||
|
|
||||||
`./build.sh` can be used to rebuild the Docker image. See `./build.sh --help` for more information.
|
`./build.sh` can be used to rebuild the Docker image. See `./build.sh --help` for more information.
|
||||||
|
|
||||||
### Publishing Docker Images
|
For more details on custom builds [consult our wiki][netbox-docker-wiki-build].
|
||||||
|
|
||||||
New Docker images are built and published every 24h on the [Docker Build Infrastructure][docker-build-infra].
|
[netbox-docker-wiki-build]: https://github.com/netbox-community/netbox-docker/wiki/Build
|
||||||
`DOCKER_HUB.md` contains more information about the build infrastructure.
|
|
||||||
|
|
||||||
[docker-build-infra]: https://hub.docker.com/r/netboxcommunity/netbox/builds/
|
### Pre-made Docker Images
|
||||||
|
|
||||||
|
New Docker images are built and published every 24h.
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
To run the tests coming with Netbox, use the `docker-compose.yml` file as such:
|
We have a test script.
|
||||||
|
It runs Netbox's own unit tests and ensures that all initializers work:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose run netbox ./manage.py test
|
IMAGE=netboxcommunity/netbox:latest ./test.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
Loading…
Reference in New Issue