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
This commit is contained in:
Lars Butler 2016-10-28 17:18:43 +02:00
parent 2407803170
commit b36e016f39
1 changed files with 6 additions and 4 deletions

View File

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