-
Notifications
You must be signed in to change notification settings - Fork 9
Add Dockerfile to build Python 3.8, 3.9, and 3.10 on Alpine Linux #20
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
|
Is using a single RUN command instead of breaking each command into a separate RUN the recommended way to structure a Dockerfile? I would think separate commands give a more layered approach to running the docker build. |
docker/Dockerfile-alpine
Outdated
| && rm -f get-pip.py \ | ||
| && rm -rf ~/.cache | ||
|
|
||
| CMD ["/bin/bash"] |
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.
We need to have something like this to choose the proper python image (taken from the other docker files)
# Run Python selection on way into image
COPY choose_python.sh /usr/bin/
ENTRYPOINT ["/usr/bin/choose_python.sh"]
``
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 is now fixed.
docker/Dockerfile-alpine
Outdated
| && apk del --no-network .fetch-deps \ | ||
| && apk del --no-network .build-deps | ||
|
|
||
| ENV PIP_ROOT_URL="https://bootstrap.pypa.io" |
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.
Why do you prefer using get-pip over using ensurepip?
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 is what is being used in the other images, and also in the official Python docker images. But I have no preference, personally.
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.
I've now switched over to ensurepip.
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.
README.md says
Pip installed for each Python via get-pip.py.
Does this also need updating?
Update: probably not, as this is just for alpine.
Yes, this is purposeful. It turns out that adding layers is very costly in terms of image size, and the best way to keep them small is to combine commands. |
Also configure /usr/bin/python to link to a version of Python that can run virtualenv, install virtualenv, and link it to where choose_python expects it to be.
|
Nice - thanks for doing this ... |
|
Test failure looks unrelated? Does this need a Travis-CI entry? |
|
I added a matrix entry for Alpine. |
|
Cool, thanks. Is there a way to confirm that the container is usable in multi-build/multibuild#430 (note that the repo has moved) |
|
I guess the trick would be to put the image up somewhere, so we could use it to test against the PR ... |
|
Probably the easiest way to do that is to merge this, so in it goes. |
|
The docker image is up https://hub.docker.com/u/multibuild. It is called "focal_alpine", maybe it should be alpine_x86_64 like the focal_x86_64 one. Is there a chance we will see an alpine_arm64v8 or alpine_i686 ? |
Dockerfile to build container required for https://github.com/matthew-brett/multibuild/pull/430