One point of optimization for your final Dockerfile example is to run the pip install piece after the requirements.txt is COPYed, instead of as far down as you put it.
Because of the layers, if requirements.txt doesn't change, the container will build faster by using the cache. But in your current set up, the second COPY command has a high likelihood of changing.
Nice article.
One point of optimization for your final Dockerfile example is to run the
pip install
piece after the requirements.txt is COPYed, instead of as far down as you put it.Because of the layers, if requirements.txt doesn't change, the container will build faster by using the cache. But in your current set up, the second COPY command has a high likelihood of changing.
What you want to do is:
Check out pythonspeed.com/articles/docker-ca... for more info.
Article updated. Thank you for the correction. Learnt something new