Skip to content

Commit a1ae13d

Browse files
committed
Allow caching of pip install
This conditionally copies over the requirements.txt. We know a Dockerfile will be available during the ONBUILD because otherwise this image could not be the source image. The copy is a hack that allows us to copy over the requirements.txt without crashing if it does not exist. Installation of the dependencies proceeds before copying over everything as done beforehand.
1 parent 9e61652 commit a1ae13d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ RUN ln -s /app /usr/src/app/ext \
2626
&& cd /usr/src/app \
2727
&& pip3 install -r requirements.txt
2828

29-
ONBUILD ADD . /app/
30-
ONBUILD RUN touch /app/__init__.py
29+
ONBUILD ADD Dockerfile requirement[s].txt /app/
3130
ONBUILD RUN cd /app/ \
3231
&& if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3332

34-
33+
ONBUILD ADD . /app/
34+
ONBUILD RUN touch /app/__init__.py

0 commit comments

Comments
 (0)