-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Switch to unconditional invocation of "get-pip.py" #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2.7/Dockerfile
Outdated
-o \ | ||
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ | ||
\) -exec rm -rf '{}' +; \ | ||
rm -rf /tmp/get-pip.py ~/.cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might just prefer adding --no-cache-dir
to your get-pip.py
call, that should tell pip not to use the cache at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, that sounds awesome 😄 -- does that mean that the "install python" layer might not need to purge ~/.cache
anymore either, now that it doesn't do anything pip-related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably? Not sure if anything else in the Python build process writes to ~/.cache
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, it is the case 🤘 (just tested) -- so the only file leftover is ~/.cache/pip/selfcheck.json
, which I got rid of by also adding --disable-pip-version-check
! 🎈
I'll update the PR shortly. 👍 ❤️ ❤️ ❤️
Combining `--without-ensurepip` / `Include_pip=0` and `get-pip.py`, we can move the `pip` installation to an entirely separate layer, thus allowing for `pip`-only bumps to build faster, given that Python will not also need to be recompiled. This also insulates us from having to decide how often to bump `setuptools` (which has a fairly aggressive release cycle) -- it will naturally bump to the latest version at every `pip` release, every Python release, or every base-image-triggered rebuild.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @tianon for your enthusiasm in figuring this stuff out 😄.
\ | ||
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ | ||
\ | ||
apk del .fetch-deps; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This spacing between the lines seems maybe a bit excessive..but nbd.
Also not sure about mixing the styles:
RUN set -x \
&& foo \
...
with
RUN set -ex; \
foo; \
...
but that's really up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's a bit odd, but it does help with the cross-variant diffs (doing vimdiff
across all the different variants in this repo gets pretty tedious, so any little bit helps). 😇 👍
Switching to semicolons is something I thought about doing to the whole file, but decided to keep the change smaller for now. We've been trying to switch most things over to semicolons (slowly), especially after having fun with things like foo && for xxx; do something-that-might-fail; done && bar
, which creates a "complex expression", and thus the rules for failure change (such that the for xxx; do ...; done
bit of that expression will only fail if the final iteration fails, for example).
From https://www.gnu.org/software/bash/manual/bashref.html#index-set:
The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of any command executed in a && or || list except the command following the final && or ||, any command in a pipeline but the last, or if the command’s return status is being inverted with !.
Thanks for taking a look 😄
- `mongo`: 3.2.13 - `python`: unconditionally invoke `get-pip.py` to install `pip` more consistently (docker-library/python#194) - `ruby`: rubygems 2.6.12
Switch to unconditional invocation of "get-pip.py"
Combining
--without-ensurepip
/Include_pip=0
andget-pip.py
, we can move thepip
installation to an entirely separate layer, thus allowing forpip
-only bumps to build faster, given that Python will not also need to be recompiled. This also insulates us from having to decide how often to bumpsetuptools
(which has a fairly aggressive release cycle) -- it will naturally bump to the latest version at everypip
release, every Python release, or every base-image-triggered rebuild.See also #186, especially #186 (comment).
Thanks to @mal for bringing the issue up originally (and suggesting pretty much this exact fix in a slightly different form 😇), @JayH5 for pointing out how aggressive the
setuptools
release cycle is, and @dstufft for being generally awesome, doing good work, and on top of all that being willing to help point us in sane directions when we're going crazy. ❤️ ❤️