nautobot-docker-compose
nautobot-docker-compose copied to clipboard
Prevision of a case where both LDAP support is needed and plugins are installed/supported
There are a lot of issues to be discussed. Normally I would create one issue named "Full review on the docker compose use cases and yml file" but I guess that's not very practical So I will create each item separately. In order to have LDAP support and install plugins at the same time, a different Dockerfile should be prepared. I am proposing a modified version of the LDAP Dockerfile, where plugins are included in one file, additional python packages in another, the nautobot_config.py file is copied over during the two stage process and the plugins and additional packages are installed by the nautobot user. Also the Dockerfile contains previsions for the ownership of the nautobot_config.py file to be retained by the nautobot user/group.
ARG PYTHON_VER=3.10
ARG NAUTOBOT_VERSION=1.4.1
FROM networktocode/nautobot:${NAUTOBOT_VERSION}-py${PYTHON_VER} as base
USER 0
RUN apt-get update -y && apt-get install -y libldap2-dev libsasl2-dev libssl-dev
# ---------------------------------
# Stage: Builder
# ---------------------------------
FROM base as builder
RUN apt-get install -y gcc && \
apt-get autoremove -y && \
apt-get clean all && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install --upgrade pip wheel && pip3 install django-auth-ldap
# ---------------------------------
# Stage: Final
# ---------------------------------
FROM base as final
ARG PYTHON_VER
USER 0
COPY --from=builder /usr/local/lib/python${PYTHON_VER}/site-packages /usr/local/lib/python${PYTHON_VER}/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --chown=nautobot:nautobot ./nautobot_config.py /opt/nautobot/nautobot_config.py
USER nautobot
WORKDIR /opt/nautobot
RUN pip install --upgrade pip wheel
COPY --chown=nautobot:nautobot ./plugin_requirements.txt /opt/nautobot/
RUN pip install --no-warn-script-location -r /opt/nautobot/plugin_requirements.txt
COPY --chown=nautobot:nautobot ./local_requirements.txt /opt/nautobot/
RUN pip install --no-warn-script-location -r /opt/nautobot/local_requirements.txt