From 0fa4f94364ae6d3d434e8bd0f76ea297e0ea3898 Mon Sep 17 00:00:00 2001 From: Daniel Dao Date: Sun, 11 Sep 2016 04:04:47 +0000 Subject: [PATCH 1/3] refactor Dockerfile to use COPY instead of clone building from the local copy instead of cloning from the internet. This also make the build more reliable as build cache is done properly based on the actual source code. Signed-off-by: Daniel Dao --- Dockerfile | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 63562e2ea..3f95d48fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,18 @@ -FROM python:2.7-wheezy +FROM python:2.7.12-wheezy WORKDIR /opt/netbox +ENTRYPOINT [ "/docker-entrypoint.sh" ] +VOLUME ["/etc/netbox-nginx/"] -ARG BRANCH=master -ARG URL=https://github.com/digitalocean/netbox.git -RUN git clone --depth 1 $URL -b $BRANCH . && \ - apt-get update -qq && apt-get install -y libldap2-dev libsasl2-dev libssl-dev && \ - pip install gunicorn==17.5 && \ - pip install django-auth-ldap && \ +COPY requirements.txt /opt/netbox/requirements.txt +RUN apt-get update -qq && apt-get install -y libldap2-dev libsasl2-dev libssl-dev && \ + pip install gunicorn==17.5 && \ + pip install django-auth-ldap && \ pip install -r requirements.txt -ADD docker/docker-entrypoint.sh /docker-entrypoint.sh -ADD netbox/netbox/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py +COPY docker/docker-entrypoint.sh /docker-entrypoint.sh +COPY docker/nginx.conf /etc/netbox-nginx/ -ENTRYPOINT [ "/docker-entrypoint.sh" ] - -ADD docker/gunicorn_config.py /opt/netbox/ -ADD docker/nginx.conf /etc/netbox-nginx/ -VOLUME ["/etc/netbox-nginx/"] +COPY . /opt/netbox +COPY netbox/netbox/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py +COPY docker/gunicorn_config.py /opt/netbox/ From 894b5fa5994a67a2c424fa1e29a8c1ba9101c5e1 Mon Sep 17 00:00:00 2001 From: Daniel Dao Date: Sun, 11 Sep 2016 04:13:27 +0000 Subject: [PATCH 2/3] add a dockerfile based on debian jessie Signed-off-by: Daniel Dao --- Dockerfile.jessie | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Dockerfile.jessie diff --git a/Dockerfile.jessie b/Dockerfile.jessie new file mode 100644 index 000000000..ea37fba1b --- /dev/null +++ b/Dockerfile.jessie @@ -0,0 +1,18 @@ +FROM python:2.7.12 + +WORKDIR /opt/netbox +ENTRYPOINT [ "/docker-entrypoint.sh" ] +VOLUME ["/etc/netbox-nginx/"] + +COPY requirements.txt /opt/netbox/requirements.txt +RUN apt-get update -qq && apt-get install -y libldap2-dev libsasl2-dev libssl-dev && \ + pip install gunicorn==17.5 && \ + pip install django-auth-ldap && \ + pip install -r requirements.txt + +COPY docker/docker-entrypoint.sh /docker-entrypoint.sh +COPY docker/nginx.conf /etc/netbox-nginx/ + +COPY . /opt/netbox +COPY netbox/netbox/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py +COPY docker/gunicorn_config.py /opt/netbox/ From 270b576c80043d13ae2365b129b9a0633777dcd2 Mon Sep 17 00:00:00 2001 From: Daniel Dao Date: Sun, 11 Sep 2016 04:38:46 +0000 Subject: [PATCH 3/3] add a docker-compose file to run jessie-based netbox To run netbox on top of python image based on debian jessie, do: ``` docker-compose -f docker-compose.yml -f docker-compose.jessie.yml build docker-compose -f docker-compose.yml -f docker-compose.jessie.yml up ``` Signed-off-by: Daniel Dao --- docker-compose.jessie.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docker-compose.jessie.yml diff --git a/docker-compose.jessie.yml b/docker-compose.jessie.yml new file mode 100644 index 000000000..8a19619e5 --- /dev/null +++ b/docker-compose.jessie.yml @@ -0,0 +1,8 @@ +version: '2' + +services: + netbox: + build: + context: . + dockerfile: Dockerfile.jessie + image: digitalocean/netbox:jessie