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 <konrad.scherer@windriver.com> for this idea.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-07-09 15:36:35 +02:00
parent 1db6b550f9
commit 16c25c9800

View File

@ -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