From 16c25c98007180e2d578cb150ae8d0f03dac2e10 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 9 Jul 2018 15:36:35 +0200 Subject: [PATCH] docker: split out pip install of requirements If we split dealing with requirements.txt out before we copy the entire source tree then docker can keep that part cached more often when we're making changes to the code and thus rebuilds are faster. Thanks to Konrad Scherer for this idea. Signed-off-by: Paul Eggleton --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d412d9d..e44116f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ ENV PYTHONUNBUFFERED=1 \ #ENV http_proxy http://your.proxy.server:port #ENV https_proxy https://your.proxy.server:port +COPY requirements.txt / RUN apt-get update RUN apt-get install -y --no-install-recommends \ python-pip \ @@ -32,10 +33,10 @@ RUN pip install --upgrade pip RUN pip3 install gunicorn RUN pip install setuptools RUN pip3 install setuptools +RUN pip install -r /requirements.txt +RUN pip3 install -r /requirements.txt RUN mkdir /opt/workdir COPY . /opt/layerindex -RUN pip install -r /opt/layerindex/requirements.txt -RUN pip3 install -r /opt/layerindex/requirements.txt COPY settings.py /opt/layerindex/settings.py COPY docker/updatelayers.sh /opt/updatelayers.sh COPY docker/migrate.sh /opt/migrate.sh