Refactor to multistage builds

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/
This commit is contained in:
Christian Mäder 2019-10-10 12:42:10 +02:00
parent aca448d180
commit 65592f916f
11 changed files with 259 additions and 246 deletions

View file

@ -1,4 +1,5 @@
FROM python:3.7-alpine3.10
ARG FROM=python:3.7-alpine
FROM ${FROM} as main
RUN apk add --no-cache \
bash \
@ -71,3 +72,14 @@ LABEL SRC_URL="$URL"
ARG NETBOX_DOCKER_PROJECT_VERSION=snapshot
LABEL NETBOX_DOCKER_PROJECT_VERSION="$NETBOX_DOCKER_PROJECT_VERSION"
#####
## LDAP specific tasks
#####
FROM main as ldap
RUN pip install django_auth_ldap
COPY docker/ldap_config.docker.py /opt/netbox/netbox/netbox/ldap_config.py
COPY configuration/ldap_config.py /etc/netbox/config/ldap_config.py