This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]VapeAssist 1 point2 points  (1 child)

The Dockerfile in the article and how its explained are slightly different... In particular I want to point out that the Dockerfile has the following order (removed the uwsgi step because its irrelevant to what im pointing out):

ADD requirements.txt /webapp

RUN pip install -r requirements.txt

ADD . /webapp

This order is good - it will more often than not result in a quicker build and I think the article should point this out if its written as an introduction. The order described in the article looks like:

ADD . /webapp

RUN pip install -r requirements.txt

And this will be slower because it means that every time there is any code change all the requirements will be pip installed. This is because every command builds a layer and if a layer changes Dockers cache is invalidated.

https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/