Skip to content

Commit

Permalink
docker: Rely on caching
Browse files Browse the repository at this point in the history
It seems less likely that tox and tox-pyenv will change than our
requirements. Split up the 'RUN' steps so we don't have to reinstall the
former every time the latter change.

Signed-off-by: Stephen Finucane <[email protected]>
  • Loading branch information
stephenfin committed Oct 17, 2019
1 parent f51e71d commit a0ca2b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@ RUN pyenv latest install 2.7 && \
pyenv latest install 3.5 && \
pyenv latest install 3.6 && \
pyenv latest install 3.7

RUN pyenv global $(pyenv versions --bare | tac)

COPY requirements-*.txt /tmp/
RUN pip install tox tox-pyenv && \
pip install -r /tmp/requirements-dev.txt
RUN pip install tox tox-pyenv

# we deliberately leave the requirements files in tmp so we can
# ping the user in entrypoint.sh if the change them!
# we deliberately leave the requirements files in /opt so we can ping the user
# in entrypoint.sh if they change
COPY requirements-dev.txt requirements-test.txt /opt/
RUN pip install -r /opt/requirements-dev.txt

COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fi
set +e

# check if we need to rebuild because requirements changed
for x in /tmp/requirements-*.txt; do
for x in /opt/requirements-*.txt; do
if ! cmp $x ~/patchwork/$(basename $x); then
cat << EOF
A requirements file has changed.
Expand Down

0 comments on commit a0ca2b9

Please sign in to comment.