From b36e016f390df59e78e6b6c92bf6cf6fdcb7aceb Mon Sep 17 00:00:00 2001 From: Lars Butler Date: Fri, 28 Oct 2016 17:18:43 +0200 Subject: [PATCH] Reorder Dockerfile to improve build times Although the original Dockerfile was quite simple and straightforward, it wasn't necessarily fast for doing repeated builds (local testing). By putting things first which rarely change (pip install of base requirements, for example), we can take advantage of docker caching to skip redundant build steps. Change-Id: I2fd961d8ad5c35280ccb23b00767acb6b5269993 --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 28d4ea8..a676127 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,8 +52,7 @@ RUN pip3 install virtualenv # Expose port EXPOSE 8080 3306 -# Add Craton -ADD . /craton +Add ./requirements.txt /requirements.txt # Init virutalenv RUN virtualenv -p /usr/bin/python3.5 /craton @@ -61,11 +60,14 @@ RUN virtualenv -p /usr/bin/python3.5 /craton # Change Working Dir WORKDIR /craton +# Install requirements +RUN bin/pip install -r /requirements.txt + # pip install mysql-python RUN bin/pip install mysqlclient -# Install requirements -RUN bin/pip install -r /craton/requirements.txt +# Add Craton +ADD . /craton # Install Craton RUN bin/pip install .