2020-04-08 08:45:56 -05:00
|
|
|
ARG FROM
|
2019-10-13 09:00:42 -05:00
|
|
|
FROM ${FROM} as builder
|
2017-04-19 09:48:21 -05:00
|
|
|
|
2021-08-31 03:57:37 -05:00
|
|
|
RUN export DEBIAN_FRONTEND=noninteractive \
|
|
|
|
&& apt-get update -qq \
|
2022-06-15 02:04:00 -05:00
|
|
|
&& apt-get upgrade \
|
|
|
|
--yes -qq --no-install-recommends \
|
|
|
|
&& apt-get install \
|
|
|
|
--yes -qq --no-install-recommends \
|
2021-08-31 03:57:37 -05:00
|
|
|
build-essential \
|
2017-04-21 06:45:34 -05:00
|
|
|
ca-certificates \
|
2021-08-31 03:57:37 -05:00
|
|
|
libldap-dev \
|
2022-06-10 03:38:21 -05:00
|
|
|
libpq-dev \
|
2021-08-31 03:57:37 -05:00
|
|
|
libsasl2-dev \
|
2022-06-10 03:38:21 -05:00
|
|
|
libssl-dev \
|
2022-10-31 10:00:18 -05:00
|
|
|
libxml2-dev \
|
|
|
|
libxmlsec1 \
|
|
|
|
libxmlsec1-dev \
|
|
|
|
libxmlsec1-openssl \
|
|
|
|
libxslt-dev \
|
|
|
|
pkg-config \
|
2020-11-10 08:23:07 -06:00
|
|
|
python3-dev \
|
2021-08-31 03:57:37 -05:00
|
|
|
python3-pip \
|
|
|
|
python3-venv \
|
|
|
|
&& python3 -m venv /opt/netbox/venv \
|
|
|
|
&& /opt/netbox/venv/bin/python3 -m pip install --upgrade \
|
2021-02-08 02:02:14 -06:00
|
|
|
pip \
|
|
|
|
setuptools \
|
|
|
|
wheel
|
2019-10-13 09:00:42 -05:00
|
|
|
|
2019-10-14 14:54:49 -05:00
|
|
|
ARG NETBOX_PATH
|
2020-11-10 08:23:07 -06:00
|
|
|
COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt /
|
2023-04-08 01:07:07 -05:00
|
|
|
RUN \
|
|
|
|
# Gunicorn is not needed because we use Nginx Unit
|
|
|
|
sed -i -e '/gunicorn/d' /requirements.txt && \
|
2023-04-06 02:52:28 -05:00
|
|
|
# We need 'social-auth-core[all]' in the Docker image. But if we put it in our own requirements-container.txt
|
|
|
|
# we have potential version conflicts and the build will fail.
|
|
|
|
# That's why we just replace it in the original requirements.txt.
|
2024-05-06 02:56:49 -05:00
|
|
|
sed -i -e 's/social-auth-core/social-auth-core\[all\]/g' /requirements.txt && \
|
2022-11-30 07:36:53 -06:00
|
|
|
/opt/netbox/venv/bin/pip install \
|
2021-02-08 02:02:14 -06:00
|
|
|
-r /requirements.txt \
|
|
|
|
-r /requirements-container.txt
|
2019-10-13 09:00:42 -05:00
|
|
|
|
|
|
|
###
|
|
|
|
# Main stage
|
|
|
|
###
|
|
|
|
|
|
|
|
ARG FROM
|
|
|
|
FROM ${FROM} as main
|
|
|
|
|
2021-08-31 03:57:37 -05: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 \
|
2022-08-31 07:11:05 -05:00
|
|
|
bzip2 \
|
2019-10-13 09:00:42 -05:00
|
|
|
ca-certificates \
|
2020-11-10 08:23:07 -06:00
|
|
|
curl \
|
2022-07-21 02:13:11 -05:00
|
|
|
libldap-common \
|
2022-06-10 03:38:21 -05:00
|
|
|
libpq5 \
|
2022-10-31 10:00:18 -05:00
|
|
|
libxmlsec1-openssl \
|
2023-08-29 06:13:57 -05:00
|
|
|
openssh-client \
|
2021-09-03 05:48:30 -05:00
|
|
|
openssl \
|
|
|
|
python3 \
|
2021-08-31 03:57:37 -05:00
|
|
|
python3-distutils \
|
2021-09-03 05:48:30 -05:00
|
|
|
tini \
|
2023-05-11 01:09:56 -05:00
|
|
|
&& curl --silent --output /usr/share/keyrings/nginx-keyring.gpg \
|
|
|
|
https://unit.nginx.org/keys/nginx-keyring.gpg \
|
2024-02-28 01:05:22 -06:00
|
|
|
&& echo "deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ mantic unit" \
|
2021-08-31 03:57:37 -05:00
|
|
|
> /etc/apt/sources.list.d/unit.list \
|
|
|
|
&& apt-get update -qq \
|
|
|
|
&& apt-get install \
|
|
|
|
--yes -qq --no-install-recommends \
|
2024-02-28 01:05:22 -06:00
|
|
|
unit=1.32.0-1~mantic \
|
|
|
|
unit-python3.11=1.32.0-1~mantic \
|
2021-08-31 03:57:37 -05:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2019-06-12 10:53:35 -05:00
|
|
|
|
2020-11-10 08:23:07 -06:00
|
|
|
COPY --from=builder /opt/netbox/venv /opt/netbox/venv
|
2019-10-14 14:54:49 -05:00
|
|
|
|
|
|
|
ARG NETBOX_PATH
|
|
|
|
COPY ${NETBOX_PATH} /opt/netbox
|
2023-04-06 04:08:34 -05:00
|
|
|
# Copy the modified 'requirements*.txt' files, to have the files actually used during installation
|
2023-04-06 02:52:28 -05:00
|
|
|
COPY --from=builder /requirements.txt /requirements-container.txt /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
|
2021-08-31 03:57:37 -05:00
|
|
|
COPY docker/ldap_config.docker.py /opt/netbox/netbox/netbox/ldap_config.py
|
2019-06-12 10:53:35 -05:00
|
|
|
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
|
2021-09-03 05:48:30 -05:00
|
|
|
COPY docker/housekeeping.sh /opt/netbox/housekeeping.sh
|
2020-11-10 08:23:07 -06:00
|
|
|
COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh
|
2020-10-17 19:34:45 -05:00
|
|
|
COPY configuration/ /etc/netbox/config/
|
2020-11-10 08:23:07 -06:00
|
|
|
COPY docker/nginx-unit.json /etc/unit/
|
2017-04-19 09:48:21 -05:00
|
|
|
|
2017-08-30 04:09:24 -05:00
|
|
|
WORKDIR /opt/netbox/netbox
|
|
|
|
|
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-11-10 08:23:07 -06:00
|
|
|
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
|
2023-04-08 01:07:07 -05:00
|
|
|
&& chown -R unit:root /opt/unit/ media reports scripts \
|
|
|
|
&& chmod -R g+w /opt/unit/ media reports scripts \
|
2023-04-27 09:47:25 -05:00
|
|
|
&& cd /opt/netbox/ && SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python -m mkdocs build \
|
2021-07-21 02:58:27 -05:00
|
|
|
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
|
2023-04-27 09:47:25 -05:00
|
|
|
&& SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
|
2019-11-17 11:03:59 -06:00
|
|
|
|
2022-10-07 01:08:30 -05:00
|
|
|
ENV LANG=C.utf8 PATH=/opt/netbox/venv/bin:$PATH
|
2021-08-31 03:57:37 -05:00
|
|
|
ENTRYPOINT [ "/usr/bin/tini", "--" ]
|
2017-04-19 09:48:21 -05:00
|
|
|
|
2021-09-13 01:18:23 -05:00
|
|
|
CMD [ "/opt/netbox/docker-entrypoint.sh", "/opt/netbox/launch-netbox.sh" ]
|
2018-02-02 05:48:38 -06:00
|
|
|
|
2021-08-31 03:57:37 -05:00
|
|
|
LABEL netbox.original-tag="" \
|
|
|
|
netbox.git-branch="" \
|
|
|
|
netbox.git-ref="" \
|
|
|
|
netbox.git-url="" \
|
2019-11-17 10:07:02 -06:00
|
|
|
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md#pre-defined-annotation-keys
|
|
|
|
org.opencontainers.image.created="" \
|
2021-02-04 14:48:08 -06: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 10:07:02 -06: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="" \
|
2022-06-15 08:47:57 -05:00
|
|
|
org.opencontainers.image.version=""
|