Merge pull request #60 from ninech/preparing_for_braking_changes

 Introduces a Netbox Docker project version
This commit is contained in:
Christian Mäder 2018-04-04 10:11:48 +02:00 committed by GitHub
commit 5b62a4c0ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 1 deletions

View File

@ -51,3 +51,6 @@ VOLUME ["/etc/netbox-nginx/"]
CMD ["gunicorn", "-c /etc/netbox/gunicorn_config.py", "netbox.wsgi"] CMD ["gunicorn", "-c /etc/netbox/gunicorn_config.py", "netbox.wsgi"]
LABEL SRC_URL="$URL" LABEL SRC_URL="$URL"
ARG NETBOX_DOCKER_PROJECT_VERSION=snapshot
LABEL NETBOX_DOCKER_PROJECT_VERSION="$NETBOX_DOCKER_PROJECT_VERSION"

View File

@ -195,7 +195,7 @@ COPY startup_scripts/ /opt/netbox/startup_scripts/
COPY initializers/ /opt/netbox/initializers/ COPY initializers/ /opt/netbox/initializers/
``` ```
## Version ## Netbox Version
The `docker-compose.yml` file is prepared to run a specific version of NetBox. The `docker-compose.yml` file is prepared to run a specific version of NetBox.
To use this feature, set the environment-variable `VERSION` before launching `docker-compose`, as shown below. To use this feature, set the environment-variable `VERSION` before launching `docker-compose`, as shown below.
@ -268,6 +268,17 @@ docker-compose rm -f netbox
docker-compose up -d netbox docker-compose up -d netbox
``` ```
### Braking Changes
From time to time it might become necessary to re-order the structure of the container.
Things like the `docker-compose.yml` file or your Kubernets or OpenShift configurations have to be adjusted as a consequence.
Since April 2018 each image built from this repo contains a `NETBOX_DOCKER_PROJECT_VERSION` label.
You can check the label of your local image by running `docker inspect ninech/netbox:v2.3.1 --format "{{json .ContainerConfig.Labels}}"`.
The following is a list of braking changes:
* 0.1.0: Introduction of the `NETBOX_DOCKER_PROJECT_VERSION`. (Not a braking change per se.)
## Rebuilding & Publishing images ## Rebuilding & Publishing images
`./build.sh` is used to rebuild the Docker image: `./build.sh` is used to rebuild the Docker image:

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.1.0

View File

@ -57,6 +57,10 @@ if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then
fi fi
fi fi
# read the project version and trim it
# see https://stackoverflow.com/a/3232433/172132
NETBOX_DOCKER_PROJECT_VERSION="${NETBOX_DOCKER_PROJECT_VERSION-$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' VERSION)}"
# variables for fetching the source # variables for fetching the source
SRC_ORG="${SRC_ORG-digitalocean}" SRC_ORG="${SRC_ORG-digitalocean}"
SRC_REPO="${SRC_REPO-netbox}" SRC_REPO="${SRC_REPO-netbox}"
@ -107,6 +111,7 @@ DOCKER_OPTS+=( "--pull" )
# Build args # Build args
DOCKER_BUILD_ARGS=( DOCKER_BUILD_ARGS=(
--build-arg "NETBOX_DOCKER_PROJECT_VERSION=${NETBOX_DOCKER_PROJECT_VERSION}"
--build-arg "FROM_TAG=${TAG}" --build-arg "FROM_TAG=${TAG}"
--build-arg "BRANCH=${BRANCH}" --build-arg "BRANCH=${BRANCH}"
--build-arg "URL=${URL}" --build-arg "URL=${URL}"