diff options
author | 2024-02-27 22:01:26 +0530 | |
---|---|---|
committer | 2024-03-02 20:22:48 -0800 | |
commit | b34b40552fb2c632908967b55bc6972068565fd7 (patch) | |
tree | dab7105bc0c324028ca39ccdb3a24c7816c58db0 | |
parent | stage3.Dockerfile: use HEREDOC syntax for RUN command (diff) | |
download | docker-images-b34b40552fb2c632908967b55bc6972068565fd7.tar.gz docker-images-b34b40552fb2c632908967b55bc6972068565fd7.tar.bz2 docker-images-b34b40552fb2c632908967b55bc6972068565fd7.zip |
python.Dockerfile: use HEREDOC syntax for RUN command
HEREDOC syntax is supported in docker
https://docs.docker.com/reference/dockerfile/#here-documents
Why:
1) better readability
2) ability to add comments
3) can treat it like another bash script
Signed-off-by: Rahil Bhimjiani <me@rahil.rocks>
Signed-off-by: John Helmert III <ajak@gentoo.org>
-rw-r--r-- | python.Dockerfile | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/python.Dockerfile b/python.Dockerfile index 7b61532..b0a5bd3 100644 --- a/python.Dockerfile +++ b/python.Dockerfile @@ -1,16 +1,31 @@ +# syntax=docker/dockerfile:1 + +# FIRST LINE IS VERY IMPORTANT. DO NOT MODIFY + FROM gentoo/stage3:amd64-nomultilib-openrc # derived from https://github.com/projg2/gentoo-python-image/blob/master/Dockerfile -RUN echo '*/* ~amd64' >> /etc/portage/package.accept_keywords/base.conf \ - && echo '*/* full-stdlib sqlite' >> /etc/portage/package.use/python \ - && echo 'dev-vcs/git -perl' >> /etc/portage/package.use/git \ - && wget --progress=dot:mega -O - https://github.com/gentoo-mirror/gentoo/archive/master.tar.gz | tar -xz \ - && mv gentoo-master /var/db/repos/gentoo \ - && emerge -1vnt --jobs dev-python/tox app-arch/lzip dev-vcs/git \ - dev-python/pypy{,3_9,3_10}-exe-bin dev-db/sqlite \ - && emerge -1v --jobs --nodeps dev-lang/python:{2.7,3.8,3.9,3.10,3.11,3.12} \ - dev-python/pypy{,3_9,3_10,3} \ - && rm -r /var/db/repos/* /var/cache/distfiles/* +RUN <<-EOF + set -e + + # configure portage + echo '*/* ~amd64' >> /etc/portage/package.accept_keywords/base.conf + echo '*/* full-stdlib sqlite' >> /etc/portage/package.use/python + echo 'dev-vcs/git -perl' >> /etc/portage/package.use/git + + # install ::gentoo + wget --progress=dot:mega -O - https://github.com/gentoo-mirror/gentoo/archive/master.tar.gz | tar -xz + mv gentoo-master /var/db/repos/gentoo + + # main job + emerge -1vnt --jobs dev-python/tox app-arch/lzip dev-vcs/git \ + dev-python/pypy{,3_9,3_10}-exe-bin dev-db/sqlite + emerge -1v --jobs --nodeps dev-lang/python:{2.7,3.8,3.9,3.10,3.11,3.12} \ + dev-python/pypy{,3_9,3_10,3} + + # cleanup + rm -r /var/db/repos/* /var/cache/distfiles/* +EOF CMD ["/bin/bash"] |