Reorder dockerfile

This creates more intermediates, but moves those that are less likely
to change to the top of the file. In theory this will produce faster
builds on a developer's machine as they won't need to apt-get update
every time.
This commit is contained in:
James Polley 2017-09-27 18:31:53 +10:00
parent 54fceededa
commit fbdf841f33

View file

@ -1,6 +1,8 @@
FROM python:3.6 FROM python:3.6
COPY constraints.txt requirements.txt /reqs/
RUN set -ex \
&& apt-get update
RUN set -ex \ RUN set -ex \
&& buildDeps=' \ && buildDeps=' \
@ -15,12 +17,18 @@ RUN set -ex \
libmemcached-dev \ libmemcached-dev \
libsasl2-dev \ libsasl2-dev \
' \ ' \
&& apt-get update \
&& apt-get install -y git xmlsec1 libmysqlclient18 \ && apt-get install -y git xmlsec1 libmysqlclient18 \
&& apt-get install -y $buildDeps --no-install-recommends \ && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/*
RUN set -ex \
&& pip install uwsgi
COPY constraints.txt requirements.txt /reqs/
RUN set -ex \
&& pip install --no-cache-dir -r /reqs/requirements.txt -c /reqs/constraints.txt \ && pip install --no-cache-dir -r /reqs/requirements.txt -c /reqs/constraints.txt \
&& pip install uwsgi \
&& apt-get purge -y --auto-remove $buildDeps \ && apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /usr/src/python ~/.cache && rm -rf /usr/src/python ~/.cache