-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: replace build image with upstream netbox image
Has been a raw python image with a fill blown Netbox build.
- Loading branch information
Felix Peters
committed
May 7, 2024
1 parent
16efe9b
commit 56b4585
Showing
5 changed files
with
301 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,14 @@ | ||
ARG netbox_ver=latest | ||
|
||
FROM python:3.11 | ||
FROM netboxcommunity/netbox:${netbox_ver} | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
|
||
RUN mkdir -p /opt | ||
|
||
RUN pip install --upgrade pip\ | ||
&& pip install poetry | ||
|
||
# ------------------------------------------------------------------------------------- | ||
# Install NetBox | ||
# ------------------------------------------------------------------------------------- | ||
ARG netbox_ver=master | ||
|
||
RUN git clone --single-branch --branch ${netbox_ver} https://github.com/netbox-community/netbox.git /opt/netbox/ && \ | ||
cd /opt/netbox/ && \ | ||
pip install -r /opt/netbox/requirements.txt | ||
|
||
# Make the django-debug-toolbar always visible when DEBUG is enabled, | ||
# except when we're running Django unit-tests. | ||
RUN echo "import sys" >> /opt/netbox/netbox/netbox/settings.py && \ | ||
echo "TESTING = len(sys.argv) > 1 and sys.argv[1] == 'test'" >> /opt/netbox/netbox/netbox/settings.py && \ | ||
echo "DEBUG_TOOLBAR_CONFIG = {'SHOW_TOOLBAR_CALLBACK': lambda _: DEBUG and not TESTING }" >> /opt/netbox/netbox/netbox/settings.py | ||
|
||
# ------------------------------------------------------------------------------------- | ||
# Install Netbox Plugin | ||
# ------------------------------------------------------------------------------------- | ||
RUN mkdir -p /source | ||
WORKDIR /source | ||
COPY . /source | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-interaction --no-ansi | ||
COPY .. /source | ||
|
||
# Install the plugin in netbox | ||
RUN /opt/netbox/venv/bin/pip install -r /source/requirements.txt | ||
RUN /opt/netbox/venv/bin/pip install --editable /source | ||
|
||
WORKDIR /opt/netbox/netbox/ |
Oops, something went wrong.