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
|
|
|
|
2017-04-21 06:45:34 -05:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
bash \
|
|
|
|
build-base \
|
2021-02-08 02:02:14 -06:00
|
|
|
cargo \
|
2017-04-21 06:45:34 -05:00
|
|
|
ca-certificates \
|
2021-09-03 02:15:41 -05:00
|
|
|
cmake \
|
2017-04-21 06:45:34 -05:00
|
|
|
cyrus-sasl-dev \
|
2021-09-03 02:15:41 -05:00
|
|
|
git \
|
2017-04-21 06:45:34 -05:00
|
|
|
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 \
|
2021-09-03 02:15:41 -05:00
|
|
|
make \
|
2021-02-08 02:02:14 -06:00
|
|
|
musl-dev \
|
2017-04-21 06:45:34 -05:00
|
|
|
openldap-dev \
|
2020-11-10 08:23:07 -06:00
|
|
|
postgresql-dev \
|
|
|
|
py3-pip \
|
|
|
|
python3-dev \
|
2021-02-08 04:59:33 -06:00
|
|
|
&& 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
|
|
|
|
2021-09-03 02:15:41 -05:00
|
|
|
# Build libcrc32c for google-crc32c python module
|
|
|
|
RUN git clone https://github.com/google/crc32c \
|
|
|
|
&& cd crc32c \
|
|
|
|
&& git submodule update --init --recursive \
|
|
|
|
&& mkdir build \
|
|
|
|
&& cd build \
|
|
|
|
&& cmake \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCRC32C_BUILD_TESTS=no \
|
|
|
|
-DCRC32C_BUILD_BENCHMARKS=no \
|
|
|
|
-DBUILD_SHARED_LIBS=yes \
|
|
|
|
.. \
|
|
|
|
&& make all install
|
|
|
|
|
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 /
|
2021-02-08 02:02:14 -06:00
|
|
|
RUN /opt/netbox/venv/bin/pip install \
|
|
|
|
-r /requirements.txt \
|
|
|
|
-r /requirements-container.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 \
|
2020-11-10 08:23:07 -06:00
|
|
|
curl \
|
2019-10-13 09:00:42 -05:00
|
|
|
graphviz \
|
|
|
|
libevent \
|
|
|
|
libffi \
|
|
|
|
libjpeg-turbo \
|
|
|
|
libxslt \
|
2021-09-03 05:48:30 -05:00
|
|
|
openssl \
|
2019-10-13 09:00:42 -05:00
|
|
|
postgresql-libs \
|
2020-11-10 08:23:07 -06:00
|
|
|
py3-pip \
|
2021-09-03 05:48:30 -05:00
|
|
|
python3 \
|
|
|
|
tini \
|
2020-11-10 08:23:07 -06:00
|
|
|
unit \
|
|
|
|
unit-python3
|
2019-05-23 10:20:39 -05:00
|
|
|
|
2019-06-12 10:53:35 -05:00
|
|
|
WORKDIR /opt
|
|
|
|
|
2021-09-03 02:15:41 -05:00
|
|
|
COPY --from=builder /usr/local/lib/libcrc32c.* /usr/local/lib/
|
|
|
|
COPY --from=builder /usr/local/include/crc32c /usr/local/include
|
|
|
|
COPY --from=builder /usr/local/lib/cmake/Crc32c /usr/local/lib/cmake/
|
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
|
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
|
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
|
2018-02-16 03:49:34 -06:00
|
|
|
COPY startup_scripts/ /opt/netbox/startup_scripts/
|
|
|
|
COPY initializers/ /opt/netbox/initializers/
|
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/ \
|
2021-09-24 01:16:07 -05:00
|
|
|
&& chown -R unit:root media /opt/unit/ \
|
2020-11-10 08:23:07 -06:00
|
|
|
&& chmod -R g+w media /opt/unit/ \
|
2021-07-21 02:58:27 -05:00
|
|
|
&& cd /opt/netbox/ && /opt/netbox/venv/bin/python -m mkdocs build \
|
|
|
|
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
|
2020-11-10 08:23:07 -06:00
|
|
|
&& SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
|
2019-11-17 11:03:59 -06:00
|
|
|
|
2021-09-13 01:18:23 -05:00
|
|
|
ENTRYPOINT [ "/sbin/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
|
|
|
|
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="" \
|
2021-02-04 14:48:08 -06: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 10:07:02 -06: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 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="" \
|
|
|
|
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
|