2019-10-10 12:42:10 +02:00
|
|
|
ARG FROM=python:3.7-alpine
|
2019-10-13 16:00:42 +02:00
|
|
|
FROM ${FROM} as builder
|
2017-04-19 16:48:21 +02:00
|
|
|
|
2017-04-21 13:45:34 +02:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
bash \
|
|
|
|
build-base \
|
|
|
|
ca-certificates \
|
|
|
|
cyrus-sasl-dev \
|
|
|
|
graphviz \
|
|
|
|
jpeg-dev \
|
2019-10-13 16:00:42 +02:00
|
|
|
libevent-dev \
|
2017-04-21 13:45:34 +02:00
|
|
|
libffi-dev \
|
|
|
|
libxslt-dev \
|
|
|
|
openldap-dev \
|
2019-10-13 16:00:42 +02:00
|
|
|
postgresql-dev
|
|
|
|
|
|
|
|
WORKDIR /install
|
2017-08-30 11:08:21 +02:00
|
|
|
|
2019-10-31 10:11:33 +01:00
|
|
|
RUN pip install --prefix="/install" --no-warn-script-location \
|
2018-02-16 10:25:26 +01:00
|
|
|
# gunicorn is used for launching netbox
|
|
|
|
gunicorn \
|
2019-10-13 16:00:42 +02:00
|
|
|
greenlet \
|
|
|
|
eventlet \
|
2018-03-06 01:56:18 +01:00
|
|
|
# napalm is used for gathering information from network devices
|
|
|
|
napalm \
|
2018-02-16 10:25:26 +01:00
|
|
|
# ruamel is used in startup_scripts
|
2019-07-30 13:09:02 +02:00
|
|
|
'ruamel.yaml>=0.15,<0.16' \
|
2019-10-13 16:00:42 +02:00
|
|
|
# django_auth_ldap is required for ldap
|
|
|
|
django_auth_ldap
|
|
|
|
|
2019-10-14 21:54:49 +02:00
|
|
|
ARG NETBOX_PATH
|
|
|
|
COPY ${NETBOX_PATH}/requirements.txt /
|
2019-10-31 10:11:33 +01:00
|
|
|
RUN pip install --prefix="/install" --no-warn-script-location -r /requirements.txt
|
2019-10-13 16:00:42 +02:00
|
|
|
|
|
|
|
###
|
|
|
|
# Main stage
|
|
|
|
###
|
|
|
|
|
|
|
|
ARG FROM
|
|
|
|
FROM ${FROM} as main
|
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
bash \
|
|
|
|
ca-certificates \
|
|
|
|
graphviz \
|
|
|
|
libevent \
|
|
|
|
libffi \
|
|
|
|
libjpeg-turbo \
|
|
|
|
libressl \
|
|
|
|
libxslt \
|
|
|
|
postgresql-libs \
|
|
|
|
ttf-ubuntu-font-family
|
2019-05-23 17:20:39 +02:00
|
|
|
|
2019-06-12 17:53:35 +02:00
|
|
|
WORKDIR /opt
|
|
|
|
|
2019-10-13 16:00:42 +02:00
|
|
|
COPY --from=builder /install /usr/local
|
2019-10-14 21:54:49 +02:00
|
|
|
|
|
|
|
ARG NETBOX_PATH
|
|
|
|
COPY ${NETBOX_PATH} /opt/netbox
|
2017-04-21 13:45:34 +02:00
|
|
|
|
2017-10-13 10:10:43 +02:00
|
|
|
COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
|
2018-04-03 09:02:19 +02:00
|
|
|
COPY configuration/gunicorn_config.py /etc/netbox/config/
|
2017-05-09 10:12:36 +02:00
|
|
|
COPY docker/nginx.conf /etc/netbox-nginx/nginx.conf
|
2019-06-12 17:53:35 +02:00
|
|
|
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
|
2018-02-16 10:49:34 +01:00
|
|
|
COPY startup_scripts/ /opt/netbox/startup_scripts/
|
|
|
|
COPY initializers/ /opt/netbox/initializers/
|
2018-04-03 09:02:19 +02:00
|
|
|
COPY configuration/configuration.py /etc/netbox/config/configuration.py
|
2017-04-19 16:48:21 +02:00
|
|
|
|
2017-08-30 11:09:24 +02:00
|
|
|
WORKDIR /opt/netbox/netbox
|
|
|
|
|
2018-02-16 10:25:26 +01:00
|
|
|
ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]
|
2017-04-19 16:48:21 +02:00
|
|
|
|
2018-08-13 23:04:09 +02:00
|
|
|
CMD ["gunicorn", "-c /etc/netbox/config/gunicorn_config.py", "netbox.wsgi"]
|
2018-02-02 12:48:38 +01:00
|
|
|
|
2019-10-14 21:54:49 +02:00
|
|
|
LABEL NETBOX_DOCKER_PROJECT_VERSION="custom build" \
|
|
|
|
NETBOX_BRANCH="custom build" \
|
|
|
|
ORIGINAL_DOCKER_TAG="custom build" \
|
|
|
|
NETBOX_GIT_COMMIT="not built from git" \
|
|
|
|
NETBOX_GIT_URL="not built from git"
|
2019-10-13 16:00:42 +02:00
|
|
|
|
2019-10-10 12:42:10 +02:00
|
|
|
#####
|
2019-10-13 16:00:42 +02:00
|
|
|
## LDAP specific configuration
|
2019-10-10 12:42:10 +02:00
|
|
|
#####
|
|
|
|
|
|
|
|
FROM main as ldap
|
|
|
|
|
2019-10-13 16:00:42 +02:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
libsasl \
|
|
|
|
libldap \
|
|
|
|
util-linux
|
2019-10-10 12:42:10 +02:00
|
|
|
|
|
|
|
COPY docker/ldap_config.docker.py /opt/netbox/netbox/netbox/ldap_config.py
|
|
|
|
COPY configuration/ldap_config.py /etc/netbox/config/ldap_config.py
|