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 <dqminh89@gmail.com>
This commit is contained in:
Daniel Dao 2016-09-11 04:04:47 +00:00
parent bffabef556
commit 0fa4f94364

View File

@ -1,20 +1,18 @@
FROM python:2.7-wheezy FROM python:2.7.12-wheezy
WORKDIR /opt/netbox WORKDIR /opt/netbox
ENTRYPOINT [ "/docker-entrypoint.sh" ]
VOLUME ["/etc/netbox-nginx/"]
ARG BRANCH=master COPY requirements.txt /opt/netbox/requirements.txt
ARG URL=https://github.com/digitalocean/netbox.git RUN apt-get update -qq && apt-get install -y libldap2-dev libsasl2-dev libssl-dev && \
RUN git clone --depth 1 $URL -b $BRANCH . && \ pip install gunicorn==17.5 && \
apt-get update -qq && apt-get install -y libldap2-dev libsasl2-dev libssl-dev && \ pip install django-auth-ldap && \
pip install gunicorn==17.5 && \
pip install django-auth-ldap && \
pip install -r requirements.txt pip install -r requirements.txt
ADD docker/docker-entrypoint.sh /docker-entrypoint.sh COPY docker/docker-entrypoint.sh /docker-entrypoint.sh
ADD netbox/netbox/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py COPY docker/nginx.conf /etc/netbox-nginx/
ENTRYPOINT [ "/docker-entrypoint.sh" ] COPY . /opt/netbox
COPY netbox/netbox/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
ADD docker/gunicorn_config.py /opt/netbox/ COPY docker/gunicorn_config.py /opt/netbox/
ADD docker/nginx.conf /etc/netbox-nginx/
VOLUME ["/etc/netbox-nginx/"]