2019-10-10 05:42:10 -05:00
|
|
|
ARG FROM=python:3.7-alpine
|
2019-10-13 09:00:42 -05:00
|
|
|
FROM ${FROM} as builder
|
2017-04-19 09:48:21 -05:00
|
|
|
|
2017-04-21 06:45:34 -05:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
bash \
|
|
|
|
build-base \
|
|
|
|
ca-certificates \
|
|
|
|
cyrus-sasl-dev \
|
|
|
|
graphviz \
|
|
|
|
jpeg-dev \
|
2019-10-13 09:00:42 -05:00
|
|
|
libevent-dev \
|
2017-04-21 06:45:34 -05:00
|
|
|
libffi-dev \
|
|
|
|
libxslt-dev \
|
|
|
|
openldap-dev \
|
2019-10-13 09:00:42 -05:00
|
|
|
postgresql-dev
|
|
|
|
|
|
|
|
WORKDIR /install
|
2017-08-30 04:08:21 -05:00
|
|
|
|
2019-10-31 04:11:33 -05:00
|
|
|
RUN pip install --prefix="/install" --no-warn-script-location \
|
2018-02-16 03:25:26 -06:00
|
|
|
# gunicorn is used for launching netbox
|
2019-11-26 04:40:10 -06:00
|
|
|
gunicorn \
|
2019-10-13 09:00:42 -05:00
|
|
|
greenlet \
|
|
|
|
eventlet \
|
2018-03-05 18:56:18 -06:00
|
|
|
# napalm is used for gathering information from network devices
|
|
|
|
napalm \
|
2018-02-16 03:25:26 -06:00
|
|
|
# ruamel is used in startup_scripts
|
2019-07-30 06:09:02 -05:00
|
|
|
'ruamel.yaml>=0.15,<0.16' \
|
2019-10-13 09:00:42 -05:00
|
|
|
# django_auth_ldap is required for ldap
|
2019-12-16 05:51:59 -06:00
|
|
|
django_auth_ldap \
|
|
|
|
# django-storages was introduced in 2.7 and is optional
|
|
|
|
django-storages
|
2019-10-13 09:00:42 -05:00
|
|
|
|
2019-10-14 14:54:49 -05:00
|
|
|
ARG NETBOX_PATH
|
|
|
|
COPY ${NETBOX_PATH}/requirements.txt /
|
2019-10-31 04:11:33 -05:00
|
|
|
RUN pip install --prefix="/install" --no-warn-script-location -r /requirements.txt
|
2019-10-13 09:00:42 -05: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 10:20:39 -05:00
|
|
|
|
2019-06-12 10:53:35 -05:00
|
|
|
WORKDIR /opt
|
|
|
|
|
2019-10-13 09:00:42 -05:00
|
|
|
COPY --from=builder /install /usr/local
|
2019-10-14 14:54:49 -05:00
|
|
|
|
|
|
|
ARG NETBOX_PATH
|
|
|
|
COPY ${NETBOX_PATH} /opt/netbox
|
2017-04-21 06:45:34 -05:00
|
|
|
|
2017-10-13 03:10:43 -05:00
|
|
|
COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
|
2018-04-03 02:02:19 -05:00
|
|
|
COPY configuration/gunicorn_config.py /etc/netbox/config/
|
2017-05-09 03:12:36 -05:00
|
|
|
COPY docker/nginx.conf /etc/netbox-nginx/nginx.conf
|
2019-06-12 10:53:35 -05:00
|
|
|
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
|
2018-02-16 03:49:34 -06:00
|
|
|
COPY startup_scripts/ /opt/netbox/startup_scripts/
|
|
|
|
COPY initializers/ /opt/netbox/initializers/
|
2018-04-03 02:02:19 -05:00
|
|
|
COPY configuration/configuration.py /etc/netbox/config/configuration.py
|
2017-04-19 09:48:21 -05:00
|
|
|
|
2017-08-30 04:09:24 -05:00
|
|
|
WORKDIR /opt/netbox/netbox
|
|
|
|
|
2019-11-17 11:03:59 -06:00
|
|
|
# Must set permissions for '/opt/netbox/netbox/static' directory
|
2019-11-18 01:23:44 -06:00
|
|
|
# to g+w so that `./manage.py collectstatic` can be executed during
|
2019-11-17 11:03:59 -06:00
|
|
|
# container startup.
|
2019-11-18 01:23:44 -06:00
|
|
|
# Must set permissions for '/opt/netbox/netbox/media' directory
|
|
|
|
# to g+w so that pictures can be uploaded to netbox.
|
2020-04-18 09:08:42 -05:00
|
|
|
RUN mkdir static && chmod -R g+w static media
|
2019-11-17 11:03:59 -06:00
|
|
|
|
2018-02-16 03:25:26 -06:00
|
|
|
ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]
|
2017-04-19 09:48:21 -05:00
|
|
|
|
2018-08-13 16:04:09 -05:00
|
|
|
CMD ["gunicorn", "-c /etc/netbox/config/gunicorn_config.py", "netbox.wsgi"]
|
2018-02-02 05:48:38 -06:00
|
|
|
|
2019-11-17 10:07:02 -06:00
|
|
|
LABEL ORIGINAL_TAG="" \
|
|
|
|
NETBOX_GIT_BRANCH="" \
|
|
|
|
NETBOX_GIT_REF="" \
|
|
|
|
NETBOX_GIT_URL="" \
|
|
|
|
# See http://label-schema.org/rc1/#build-time-labels
|
|
|
|
# Also https://microbadger.com/labels
|
|
|
|
org.label-schema.schema-version="1.0" \
|
|
|
|
org.label-schema.build-date="" \
|
|
|
|
org.label-schema.name="Netbox Docker" \
|
|
|
|
org.label-schema.description="A container based distribution of Netbox, the free and open IPAM and DCIM solution." \
|
|
|
|
org.label-schema.vendor="The netbox-docker contributors." \
|
|
|
|
org.label-schema.url="https://github.com/netbox-community/netbox-docker" \
|
|
|
|
org.label-schema.usage="https://github.com/netbox-community/netbox-docker/wiki" \
|
|
|
|
org.label-schema.vcs-url="https://github.com/netbox-community/netbox-docker.git" \
|
|
|
|
org.label-schema.vcs-ref="" \
|
|
|
|
org.label-schema.version="snapshot" \
|
|
|
|
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md#pre-defined-annotation-keys
|
|
|
|
org.opencontainers.image.created="" \
|
|
|
|
org.opencontainers.image.title="Netbox Docker" \
|
|
|
|
org.opencontainers.image.description="A container based distribution of Netbox, the free and open IPAM and DCIM solution." \
|
|
|
|
org.opencontainers.image.licenses="Apache-2.0" \
|
|
|
|
org.opencontainers.image.authors="The netbox-docker contributors." \
|
|
|
|
org.opencontainers.image.vendor="The netbox-docker contributors." \
|
|
|
|
org.opencontainers.image.url="https://github.com/netbox-community/netbox-docker" \
|
|
|
|
org.opencontainers.image.documentation="https://github.com/netbox-community/netbox-docker/wiki" \
|
|
|
|
org.opencontainers.image.source="https://github.com/netbox-community/netbox-docker.git" \
|
|
|
|
org.opencontainers.image.revision="" \
|
|
|
|
org.opencontainers.image.version="snapshot"
|
2019-10-13 09:00:42 -05:00
|
|
|
|
2019-10-10 05:42:10 -05:00
|
|
|
#####
|
2019-10-13 09:00:42 -05:00
|
|
|
## LDAP specific configuration
|
2019-10-10 05:42:10 -05:00
|
|
|
#####
|
|
|
|
|
|
|
|
FROM main as ldap
|
|
|
|
|
2019-10-13 09:00:42 -05:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
libsasl \
|
|
|
|
libldap \
|
|
|
|
util-linux
|
2019-10-10 05:42:10 -05: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
|