|
| 1 | +# Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Amazon Software License (the "License"). You may not use this file except in compliance with the License. |
| 4 | +# A copy of the License is located at |
| 5 | +# |
| 6 | +# http://aws.amazon.com/asl/ |
| 7 | +# |
| 8 | +# or in the "license" file accompanying this file. |
| 9 | +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. |
| 10 | +# See the License for the specific language governing permissions and limitations under the License. |
| 11 | +# |
| 12 | + |
| 13 | +FROM ubuntu:14.04.5 |
| 14 | + |
| 15 | +ENV LANG="C.UTF-8" |
| 16 | + |
| 17 | +ENV DOCKER_BUCKET="download.docker.com" \ |
| 18 | + DOCKER_VERSION="17.09.0-ce" \ |
| 19 | + DOCKER_CHANNEL="stable" \ |
| 20 | + DOCKER_SHA256="a9e90a73c3cdfbf238f148e1ec0eaff5eb181f92f35bdd938fd7dab18e1c4647" \ |
| 21 | + DIND_COMMIT="3b5fac462d21ca164b3778647420016315289034" \ |
| 22 | + DOCKER_COMPOSE_VERSION="1.16.1" \ |
| 23 | + GITVERSION_VERSION="3.6.5" |
| 24 | + |
| 25 | +# Building git from source code: |
| 26 | +# Ubuntu's default git package is built with broken gnutls. Rebuild git with openssl. |
| 27 | +########################################################################## |
| 28 | +RUN set -ex \ |
| 29 | + && echo 'Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/99use-gzip-compression \ |
| 30 | + && apt-get update \ |
| 31 | + && apt-get install -y --no-install-recommends \ |
| 32 | + wget=1.15-* fakeroot=1.20-* ca-certificates \ |
| 33 | + && apt-get -qy build-dep git=1:1.9.1 \ |
| 34 | + && apt-get -qy install libcurl4-openssl-dev=7.35.0-* git-man=1:1.9.1-* liberror-perl=0.17-* \ |
| 35 | + && mkdir -p /usr/src/git-openssl \ |
| 36 | + && cd /usr/src/git-openssl \ |
| 37 | + && apt-get source git=1:1.9.1 \ |
| 38 | + && cd $(find -mindepth 1 -maxdepth 1 -type d -name "git-*") \ |
| 39 | + && sed -i -- 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/' ./debian/control \ |
| 40 | + && sed -i -- '/TEST\s*=\s*test/d' ./debian/rules \ |
| 41 | + && dpkg-buildpackage -rfakeroot -b \ |
| 42 | + && find .. -type f -name "git_*ubuntu*.deb" -exec dpkg -i \{\} \; \ |
| 43 | + && rm -rf /usr/src/git-openssl \ |
| 44 | + && rm -rf /var/lib/apt/lists/* \ |
| 45 | +# Install dependencies by all python images equivalent to buildpack-deps:jessie |
| 46 | +# on the public repos. |
| 47 | + && apt-get update && apt-get install -y --no-install-recommends autoconf=2.69-* automake=1:1.14.1-* \ |
| 48 | + bzip2=1.0.6-* file=1:5.14-* g++=4:4.8.2-* gcc=4:4.8.2-* imagemagick=8:6.7.7.10-* \ |
| 49 | + libbz2-dev=1.0.6-* libc6-dev=2.19-* libcurl4-openssl-dev=7.35.0-* curl=7.35.0-* \ |
| 50 | + libdb-dev=1:5.3.21~* libevent-dev=2.0.21-stable-* libffi-dev=3.1~rc1+r3.0.13-* \ |
| 51 | + libgeoip-dev=1.6.0-* libglib2.0-dev=2.40.2-* libjpeg-dev=8c-* \ |
| 52 | + libkrb5-dev=1.12+dfsg-* liblzma-dev=5.1.1alpha+20120614-* libmagickcore-dev=8:6.7.7.10-* \ |
| 53 | + libmagickwand-dev=8:6.7.7.10-* libmysqlclient-dev=5.5.60-* libncurses5-dev=5.9+20140118-* \ |
| 54 | + libpng12-dev=1.2.50-* libpq-dev=9.3.22-* libreadline-dev=6.3-* libsqlite3-dev=3.8.2-* \ |
| 55 | + libssl-dev=1.0.1f-* libtool=2.4.2-* libwebp-dev=0.4.0-* libxml2-dev=2.9.1+dfsg1-* \ |
| 56 | + libxslt1-dev=1.1.28-* libyaml-dev=0.1.4-* make=3.81-* patch=2.7.1-* xz-utils=5.1.1alpha+20120614-* \ |
| 57 | + zlib1g-dev=1:1.2.8.dfsg-* tcl=8.6.0+* tk=8.6.0+* ca-certificates \ |
| 58 | + e2fsprogs=1.42.9-* iptables=1.4.21-* xfsprogs=3.1.9ubuntu2 xz-utils=5.1.1alpha+20120614-* \ |
| 59 | + mono-mcs=3.2.8+dfsg-* \ |
| 60 | + && apt-get install -y -qq less=458-* groff=1.22.2-* \ |
| 61 | + && rm -rf /var/lib/apt/lists/* |
| 62 | + |
| 63 | +# Download and set up GitVersion |
| 64 | +RUN set -ex \ |
| 65 | + && wget "https://github.com/GitTools/GitVersion/releases/download/v${GITVERSION_VERSION}/GitVersion_${GITVERSION_VERSION}.zip" -O /tmp/GitVersion_${GITVERSION_VERSION}.zip \ |
| 66 | + && mkdir -p /usr/local/GitVersion_${GITVERSION_VERSION} \ |
| 67 | + && unzip /tmp/GitVersion_${GITVERSION_VERSION}.zip -d /usr/local/GitVersion_${GITVERSION_VERSION} \ |
| 68 | + && rm /tmp/GitVersion_${GITVERSION_VERSION}.zip \ |
| 69 | + && echo "mono /usr/local/GitVersion_${GITVERSION_VERSION}/GitVersion.exe /output json /showvariable \$1" >> /usr/local/bin/gitversion \ |
| 70 | + && chmod +x /usr/local/bin/gitversion |
| 71 | + |
| 72 | +RUN set -ex \ |
| 73 | + && curl -fSL "https://${DOCKER_BUCKET}/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz" -o docker.tgz \ |
| 74 | + && echo "${DOCKER_SHA256} *docker.tgz" | sha256sum -c - \ |
| 75 | + && tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ \ |
| 76 | + && rm docker.tgz \ |
| 77 | + && docker -v \ |
| 78 | +# set up subuid/subgid so that "--userns-remap=default" works out-of-the-box |
| 79 | + && addgroup dockremap \ |
| 80 | + && useradd -g dockremap dockremap \ |
| 81 | + && echo 'dockremap:165536:65536' >> /etc/subuid \ |
| 82 | + && echo 'dockremap:165536:65536' >> /etc/subgid \ |
| 83 | + && wget "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind" -O /usr/local/bin/dind \ |
| 84 | + && curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 > /usr/local/bin/docker-compose \ |
| 85 | + && chmod +x /usr/local/bin/dind /usr/local/bin/docker-compose \ |
| 86 | +# Ensure docker-compose works |
| 87 | + && docker-compose version |
| 88 | + |
| 89 | +VOLUME /var/lib/docker |
| 90 | + |
| 91 | +COPY dockerd-entrypoint.sh /usr/local/bin/ |
| 92 | + |
| 93 | +ENV PATH="/usr/local/bin:$PATH" \ |
| 94 | + GPG_KEY="0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D" \ |
| 95 | + PYTHON_VERSION="3.6.5" \ |
| 96 | + PYTHON_PIP_VERSION="10.0.0" \ |
| 97 | + LC_ALL=C.UTF-8 \ |
| 98 | + LANG=C.UTF-8 |
| 99 | + |
| 100 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 101 | + tcl-dev tk-dev \ |
| 102 | + && rm -rf /var/lib/apt/lists/* \ |
| 103 | + \ |
| 104 | + && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ |
| 105 | + && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ |
| 106 | + && export GNUPGHOME="$(mktemp -d)" \ |
| 107 | + && (gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ |
| 108 | + || gpg --keyserver pgp.mit.edu --recv-keys "$GPG_KEY" \ |
| 109 | + || gpg --keyserver keyserver.ubuntu.com --recv-keys "$GPG_KEY") \ |
| 110 | + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ |
| 111 | + && rm -r "$GNUPGHOME" python.tar.xz.asc \ |
| 112 | + && mkdir -p /usr/src/python \ |
| 113 | + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ |
| 114 | + && rm python.tar.xz \ |
| 115 | + \ |
| 116 | + && cd /usr/src/python \ |
| 117 | + && ./configure \ |
| 118 | + --enable-loadable-sqlite-extensions \ |
| 119 | + --enable-shared \ |
| 120 | + && make -j$(nproc) \ |
| 121 | + && make install \ |
| 122 | + && ldconfig \ |
| 123 | + \ |
| 124 | +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere |
| 125 | + && if [ ! -e /usr/local/bin/pip3 ]; then : \ |
| 126 | + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ |
| 127 | + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ |
| 128 | + && rm /tmp/get-pip.py \ |
| 129 | + ; fi \ |
| 130 | +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python |
| 131 | +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") |
| 132 | +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 |
| 133 | + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ |
| 134 | + && pip install awscli boto3 pipenv virtualenv --no-cache-dir \ |
| 135 | +# then we use "pip list" to ensure we don't have more than one pip version installed |
| 136 | +# https://github.com/docker-library/python/pull/100 |
| 137 | + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ |
| 138 | + \ |
| 139 | + && find /usr/local -depth \ |
| 140 | + \( \ |
| 141 | + \( -type d -a -name test -o -name tests \) \ |
| 142 | + -o \ |
| 143 | + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ |
| 144 | + \) -exec rm -rf '{}' + \ |
| 145 | + && apt-get purge -y --auto-remove tcl-dev tk-dev \ |
| 146 | + && rm -rf /usr/src/python ~/.cache \ |
| 147 | + && cd /usr/local/bin \ |
| 148 | + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ |
| 149 | + && ln -s idle3 idle \ |
| 150 | + && ln -s pydoc3 pydoc \ |
| 151 | + && ln -s python3 python \ |
| 152 | + && ln -s python3-config python-config \ |
| 153 | + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 154 | + |
| 155 | +CMD ["python3"] |
| 156 | + |
| 157 | +ENTRYPOINT ["dockerd-entrypoint.sh"] |
0 commit comments