From: W. Trevor King Date: Thu, 31 Jul 2014 21:31:16 +0000 (-0700) Subject: gentoo-python: Remove Python 2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a5a76d4617c7580f286d547a35edde0167bb1f54;p=dockerfile.git gentoo-python: Remove Python 2 Portage runs fine on Python 3, and there's no need to have multiple versions of Python installed. Removing it here allows us to trim down to smaller images, because Python's pretty heavy: $ docker run -i -t --rm wking/gentoo-portage:20140717 /bin/bash d1cdbe4c737a / # du -hs /usr/lib64/python2.7/ 66M /usr/lib64/python2.7/ My current trimmed ngircd is only image is 341 MB: $ docker images wking/ngircd-trimmed | grep 20140717 wking/ngircd-trimmed 20140717 98daec1a09c5 16 hours ago 340.9 MB so about 20% of the trimmed image is a useless old Python version. We could shrink the trimmed image even more by removing Portage and Python 3, but that requires some external-to-Portage hackery. This is easy to do, and folks who *do* need Python 2 can easily adjust their PYTHON_TARGETS, PYTHON_SINGLE_TARGET, eselected Python, and re-emerge. We only need to emerge @system, because @world is still empty at this point. --- diff --git a/README.md b/README.md index 8db851b..38199d1 100644 --- a/README.md +++ b/README.md @@ -18,29 +18,30 @@ The dependency graph is: wking/gentoo (amd64 stage3) `-- gentoo-portage (adds portage directory) - `-- gentoo-utc (adds a system timezone) - `-- gentoo-en-us (adds locale) - `-- gentoo-openrc (configure OpenRC for Docker) - `-- gentoo-syslog (adds syslog-ng and associates) - |-- buildbot (adds a Buildbot master and slave) - |-- docker-registry (adds a Docker registry server) - |-- gentoo-layman (adds layman for Gentoo overlays) - | `-- package-cache (adds a package-cache proxy) - |-- gentoo-node (adds Node and npm) - | `-- hubot (adds hubot with an IRC adapter) - |-- irker (adds irker, and spawns irkerd by default) - |-- memcached (adds Memcached) - |-- nginx (adds Nginx) - | |-- nginx-proxy (SSL/TLS proxying via SNI) - | |-- kibana (adds Kibana) - | `-- kibana-azure (adds Azure's Kibana) - |-- ngircd (adds ngIRCd) - |-- postgresql (adds PostgreSQL) - |-- redis (adds Redis) - |-- salt-minion (adds a Salt Stack minion) - |-- stunnel (adds stunnel) - `-- gentoo-java (adds IcedTea) - `-- elasticsearch (adds Elasticsearch) + `-- gentoo-python (drops Python 2.7) + `-- gentoo-utc (adds a system timezone) + `-- gentoo-en-us (adds locale) + `-- gentoo-openrc (configure OpenRC for Docker) + `-- gentoo-syslog (adds syslog-ng and associates) + |-- buildbot (adds a Buildbot master and slave) + |-- docker-registry (adds a Docker registry server) + |-- gentoo-layman (adds layman for Gentoo overlays) + | `-- package-cache (adds a package-cache proxy) + |-- gentoo-node (adds Node and npm) + | `-- hubot (adds hubot with an IRC adapter) + |-- irker (adds irker, and spawns irkerd by default) + |-- memcached (adds Memcached) + |-- nginx (adds Nginx) + | |-- nginx-proxy (SSL/TLS proxying via SNI) + | |-- kibana (adds Kibana) + | `-- kibana-azure (adds Azure's Kibana) + |-- ngircd (adds ngIRCd) + |-- postgresql (adds PostgreSQL) + |-- redis (adds Redis) + |-- salt-minion (adds a Salt Stack minion) + |-- stunnel (adds stunnel) + `-- gentoo-java (adds IcedTea) + `-- elasticsearch (adds Elasticsearch) Run: diff --git a/build.sh b/build.sh index 4ade662..5b18d31 100755 --- a/build.sh +++ b/build.sh @@ -43,6 +43,7 @@ BUILD_OPTS="${BUILD_OPTS:-}" REPOS="${REPOS:- portage gentoo-portage + gentoo-python gentoo-utc gentoo-en-us gentoo-openrc diff --git a/gentoo-python/Dockerfile.template b/gentoo-python/Dockerfile.template new file mode 100644 index 0000000..d33f48c --- /dev/null +++ b/gentoo-python/Dockerfile.template @@ -0,0 +1,34 @@ +# Copyright (C) 2014 W. Trevor King +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +FROM ${NAMESPACE}/gentoo-portage:${TAG} +MAINTAINER ${MAINTAINER} +#VOLUME ["${PORTAGE}:/usr/portage:ro", "${PORTAGE}/distfiles:/usr/portage/distfiles:rw"] +RUN PYTHON_TARGETS=$(emerge --info | sed -n 's/.*PYTHON_TARGETS="\([^"]*\)".*/\1/p') && \ + PYTHON_TARGET="${PYTHON_TARGETS##* }" && \ + echo "PYTHON_TARGETS=\"${PYTHON_TARGET}\"" >> /etc/portage/make.conf && \ + echo "PYTHON_SINGLE_TARGET=\"${PYTHON_TARGET}\"" >> /etc/portage/make.conf +RUN eselect python set $(eselect python show --python3) +RUN emerge --newuse --deep --with-bdeps=y @system +RUN emerge --depclean diff --git a/gentoo-utc/Dockerfile.template b/gentoo-utc/Dockerfile.template index 6b80bbe..2d96c4b 100644 --- a/gentoo-utc/Dockerfile.template +++ b/gentoo-utc/Dockerfile.template @@ -22,7 +22,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -FROM ${NAMESPACE}/gentoo-portage:${TAG} +FROM ${NAMESPACE}/gentoo-python:${TAG} MAINTAINER ${MAINTAINER} #VOLUME ["${PORTAGE}:/usr/portage:ro", "${PORTAGE}/distfiles:/usr/portage/distfiles:rw"] RUN echo 'UTC' > /etc/timezone