From 9f0e02a984cc9e19772829a7f001cd86cf98550c Mon Sep 17 00:00:00 2001
From: Tobias Genannt <t.genannt@scanplus.de>
Date: Tue, 7 May 2019 09:51:46 +0200
Subject: [PATCH] Optimised Django installation

With version 2.5.11 Netbox moved to Django 2.2 but the Dockerfile
stilled pulled 2.1.x in. With this change the requirements from Netbox
are installed first. So we have the correct version of Django installed
and the additional software can use is directly
---
 Dockerfile | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index f7d22a3..26aa8c2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,20 +15,6 @@ RUN apk add --no-cache \
       ttf-ubuntu-font-family \
       wget
 
-RUN pip install \
-# gunicorn is used for launching netbox
-      gunicorn \
-# napalm is used for gathering information from network devices
-      napalm \
-# ruamel is used in startup_scripts
-      ruamel.yaml \
-# pinning django to the version required by netbox
-# adding it here, to install the correct version of
-# django-rq
-      'Django>=2.1.5,<2.2' \
-# django-rq is used for webhooks
-      django-rq
-
 WORKDIR /opt
 
 ARG BRANCH=master
@@ -39,6 +25,16 @@ RUN wget -q -O - "${URL}" | tar xz \
 WORKDIR /opt/netbox
 RUN pip install -r requirements.txt
 
+RUN pip install \
+# gunicorn is used for launching netbox
+      gunicorn \
+# napalm is used for gathering information from network devices
+      napalm \
+# ruamel is used in startup_scripts
+      ruamel.yaml \
+# django-rq is used for webhooks
+      django-rq
+
 COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
 COPY configuration/gunicorn_config.py /etc/netbox/config/
 COPY docker/nginx.conf /etc/netbox-nginx/nginx.conf