2020-04-08 15:45:56 +02:00
|
|
|
ARG FROM
|
2019-10-13 16:00:42 +02:00
|
|
|
FROM ${FROM} as builder
|
2017-04-19 16:48:21 +02:00
|
|
|
|
2021-08-31 10:57:37 +02:00
|
|
|
RUN export DEBIAN_FRONTEND=noninteractive \
|
|
|
|
&& apt-get update -qq \
|
|
|
|
&& apt-get install --yes -qq \
|
|
|
|
build-essential \
|
2017-04-21 13:45:34 +02:00
|
|
|
ca-certificates \
|
2021-08-31 10:57:37 +02:00
|
|
|
libldap-dev \
|
2022-06-10 10:38:21 +02:00
|
|
|
libpq-dev \
|
2021-08-31 10:57:37 +02:00
|
|
|
libsasl2-dev \
|
2022-06-10 10:38:21 +02:00
|
|
|
libssl-dev \
|
2020-11-10 15:23:07 +01:00
|
|
|
python3-dev \
|
2021-08-31 10:57:37 +02:00
|
|
|
python3-pip \
|
|
|
|
python3-venv \
|
|
|
|
&& python3 -m venv /opt/netbox/venv \
|
|
|
|
&& /opt/netbox/venv/bin/python3 -m pip install --upgrade \
|
2021-02-08 09:02:14 +01:00
|
|
|
pip \
|
|
|
|
setuptools \
|
|
|
|
wheel
|
2019-10-13 16:00:42 +02:00
|
|
|
|
2019-10-14 21:54:49 +02:00
|
|
|
ARG NETBOX_PATH
|
2020-11-10 15:23:07 +01:00
|
|
|
COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt /
|
2021-02-08 09:02:14 +01:00
|
|
|
RUN /opt/netbox/venv/bin/pip install \
|
|
|
|
-r /requirements.txt \
|
|
|
|
-r /requirements-container.txt
|
2019-10-13 16:00:42 +02:00
|
|
|
|
|
|
|
###
|
|
|
|
# Main stage
|
|
|
|
###
|
|
|
|
|
|
|
|
ARG FROM
|
|
|
|
FROM ${FROM} as main
|
|
|
|
|
2021-08-31 10:57:37 +02:00
|
|
|
RUN export DEBIAN_FRONTEND=noninteractive \
|
|
|
|
&& apt-get update -qq \
|
|
|
|
&& apt-get upgrade \
|
|
|
|
--yes -qq --no-install-recommends \
|
|
|
|
&& apt-get install \
|
|
|
|
--yes -qq --no-install-recommends \
|
2019-10-13 16:00:42 +02:00
|
|
|
ca-certificates \
|
2020-11-10 15:23:07 +01:00
|
|
|
curl \
|
2022-06-10 10:38:21 +02:00
|
|
|
libpq5 \
|
2021-09-03 12:48:30 +02:00
|
|
|
openssl \
|
|
|
|
python3 \
|
2021-08-31 10:57:37 +02:00
|
|
|
python3-distutils \
|
2021-09-03 12:48:30 +02:00
|
|
|
tini \
|
2021-08-31 10:57:37 +02:00
|
|
|
&& curl -sL https://nginx.org/keys/nginx_signing.key \
|
|
|
|
> /etc/apt/trusted.gpg.d/nginx.asc && \
|
|
|
|
echo "deb https://packages.nginx.org/unit/debian/ bullseye unit" \
|
|
|
|
> /etc/apt/sources.list.d/unit.list \
|
|
|
|
&& apt-get update -qq \
|
|
|
|
&& apt-get install \
|
|
|
|
--yes -qq --no-install-recommends \
|
|
|
|
unit=1.27.0-1~bullseye \
|
|
|
|
unit-python3.9=1.27.0-1~bullseye \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2019-06-12 17:53:35 +02:00
|
|
|
|
2020-11-10 15:23:07 +01:00
|
|
|
COPY --from=builder /opt/netbox/venv /opt/netbox/venv
|
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
|
2021-08-31 10:57:37 +02:00
|
|
|
COPY docker/ldap_config.docker.py /opt/netbox/netbox/netbox/ldap_config.py
|
2019-06-12 17:53:35 +02:00
|
|
|
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
|
2021-09-03 12:48:30 +02:00
|
|
|
COPY docker/housekeeping.sh /opt/netbox/housekeeping.sh
|
2020-11-10 15:23:07 +01:00
|
|
|
COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh
|
2018-02-16 10:49:34 +01:00
|
|
|
COPY startup_scripts/ /opt/netbox/startup_scripts/
|
|
|
|
COPY initializers/ /opt/netbox/initializers/
|
2020-10-18 02:34:45 +02:00
|
|
|
COPY configuration/ /etc/netbox/config/
|
2020-11-10 15:23:07 +01:00
|
|
|
COPY docker/nginx-unit.json /etc/unit/
|
2017-04-19 16:48:21 +02:00
|
|
|
|
2017-08-30 11:09:24 +02:00
|
|
|
WORKDIR /opt/netbox/netbox
|
|
|
|
|
2019-11-18 08:23:44 +01:00
|
|
|
# Must set permissions for '/opt/netbox/netbox/media' directory
|
|
|
|
# to g+w so that pictures can be uploaded to netbox.
|
2020-11-10 15:23:07 +01:00
|
|
|
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
|
2021-09-24 08:16:07 +02:00
|
|
|
&& chown -R unit:root media /opt/unit/ \
|
2020-11-10 15:23:07 +01:00
|
|
|
&& chmod -R g+w media /opt/unit/ \
|
2022-02-02 16:49:29 +01:00
|
|
|
&& cd /opt/netbox/ && SECRET_KEY="dummy" /opt/netbox/venv/bin/python -m mkdocs build \
|
2021-07-21 09:58:27 +02:00
|
|
|
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
|
2020-11-10 15:23:07 +01:00
|
|
|
&& SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
|
2019-11-17 18:03:59 +01:00
|
|
|
|
2021-08-31 10:57:37 +02:00
|
|
|
ENV LANG=C.UTF-8
|
|
|
|
ENTRYPOINT [ "/usr/bin/tini", "--" ]
|
2017-04-19 16:48:21 +02:00
|
|
|
|
2021-09-13 08:18:23 +02:00
|
|
|
CMD [ "/opt/netbox/docker-entrypoint.sh", "/opt/netbox/launch-netbox.sh" ]
|
2018-02-02 12:48:38 +01:00
|
|
|
|
2021-08-31 10:57:37 +02:00
|
|
|
LABEL netbox.original-tag="" \
|
|
|
|
netbox.git-branch="" \
|
|
|
|
netbox.git-ref="" \
|
|
|
|
netbox.git-url="" \
|
2019-11-17 17:07:02 +01:00
|
|
|
# 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="" \
|
2021-02-04 21:48:08 +01:00
|
|
|
org.label-schema.name="NetBox Docker" \
|
|
|
|
org.label-schema.description="A container based distribution of NetBox, the free and open IPAM and DCIM solution." \
|
2019-11-17 17:07:02 +01:00
|
|
|
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="" \
|
2021-02-04 21:48:08 +01:00
|
|
|
org.opencontainers.image.title="NetBox Docker" \
|
|
|
|
org.opencontainers.image.description="A container based distribution of NetBox, the free and open IPAM and DCIM solution." \
|
2019-11-17 17:07:02 +01:00
|
|
|
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"
|