Skip to content

Commit

Permalink
* Add new image: Phython 3.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Xin Wang committed May 9, 2018
1 parent da5cf23 commit 01bfc1f
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ The following images are actively maintained by AWS CodeBuild, and are listed in
+ [python 3.3.6](ubuntu/python/3.3.6)
+ [python 3.4.5](ubuntu/python/3.4.5)
+ [python 3.5.2](ubuntu/python/3.5.2)
+ [python 3.6.5](ubuntu/python/3.6.5)
+ [ruby 2.2.5](ubuntu/ruby/2.2.5)
+ [ruby 2.3.1](ubuntu/ruby/2.3.1)
+ [ruby 2.5.1](ubuntu/ruby/2.5.1)
Expand Down
2 changes: 2 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ phases:
- docker build -t aws/codebuild/python:3.4.5 .
- cd $CODEBUILD_SRC_DIR/ubuntu/python/3.5.2
- docker build -t aws/codebuild/python:3.5.2 .
- cd $CODEBUILD_SRC_DIR/ubuntu/python/3.6.5
- docker build -t aws/codebuild/python:3.6.5 .
- cd $CODEBUILD_SRC_DIR/ubuntu/ruby/2.2.5
- docker build -t aws/codebuild/ruby:2.2.5 .
- cd $CODEBUILD_SRC_DIR/ubuntu/ruby/2.3.1
Expand Down
157 changes: 157 additions & 0 deletions ubuntu/python/3.6.5/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/asl/
#
# or in the "license" file accompanying this file.
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
# See the License for the specific language governing permissions and limitations under the License.
#

FROM ubuntu:14.04.5

ENV LANG="C.UTF-8"

ENV DOCKER_BUCKET="download.docker.com" \
DOCKER_VERSION="17.09.0-ce" \
DOCKER_CHANNEL="stable" \
DOCKER_SHA256="a9e90a73c3cdfbf238f148e1ec0eaff5eb181f92f35bdd938fd7dab18e1c4647" \
DIND_COMMIT="3b5fac462d21ca164b3778647420016315289034" \
DOCKER_COMPOSE_VERSION="1.16.1" \
GITVERSION_VERSION="3.6.5"

# Building git from source code:
# Ubuntu's default git package is built with broken gnutls. Rebuild git with openssl.
##########################################################################
RUN set -ex \
&& echo 'Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/99use-gzip-compression \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
wget=1.15-* fakeroot=1.20-* ca-certificates \
&& apt-get -qy build-dep git=1:1.9.1 \
&& apt-get -qy install libcurl4-openssl-dev=7.35.0-* git-man=1:1.9.1-* liberror-perl=0.17-* \
&& mkdir -p /usr/src/git-openssl \
&& cd /usr/src/git-openssl \
&& apt-get source git=1:1.9.1 \
&& cd $(find -mindepth 1 -maxdepth 1 -type d -name "git-*") \
&& sed -i -- 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/' ./debian/control \
&& sed -i -- '/TEST\s*=\s*test/d' ./debian/rules \
&& dpkg-buildpackage -rfakeroot -b \
&& find .. -type f -name "git_*ubuntu*.deb" -exec dpkg -i \{\} \; \
&& rm -rf /usr/src/git-openssl \
&& rm -rf /var/lib/apt/lists/* \
# Install dependencies by all python images equivalent to buildpack-deps:jessie
# on the public repos.
&& apt-get update && apt-get install -y --no-install-recommends autoconf=2.69-* automake=1:1.14.1-* \
bzip2=1.0.6-* file=1:5.14-* g++=4:4.8.2-* gcc=4:4.8.2-* imagemagick=8:6.7.7.10-* \
libbz2-dev=1.0.6-* libc6-dev=2.19-* libcurl4-openssl-dev=7.35.0-* curl=7.35.0-* \
libdb-dev=1:5.3.21~* libevent-dev=2.0.21-stable-* libffi-dev=3.1~rc1+r3.0.13-* \
libgeoip-dev=1.6.0-* libglib2.0-dev=2.40.2-* libjpeg-dev=8c-* \
libkrb5-dev=1.12+dfsg-* liblzma-dev=5.1.1alpha+20120614-* libmagickcore-dev=8:6.7.7.10-* \
libmagickwand-dev=8:6.7.7.10-* libmysqlclient-dev=5.5.60-* libncurses5-dev=5.9+20140118-* \
libpng12-dev=1.2.50-* libpq-dev=9.3.22-* libreadline-dev=6.3-* libsqlite3-dev=3.8.2-* \
libssl-dev=1.0.1f-* libtool=2.4.2-* libwebp-dev=0.4.0-* libxml2-dev=2.9.1+dfsg1-* \
libxslt1-dev=1.1.28-* libyaml-dev=0.1.4-* make=3.81-* patch=2.7.1-* xz-utils=5.1.1alpha+20120614-* \
zlib1g-dev=1:1.2.8.dfsg-* tcl=8.6.0+* tk=8.6.0+* ca-certificates \
e2fsprogs=1.42.9-* iptables=1.4.21-* xfsprogs=3.1.9ubuntu2 xz-utils=5.1.1alpha+20120614-* \
mono-mcs=3.2.8+dfsg-* \
&& apt-get install -y -qq less=458-* groff=1.22.2-* \
&& rm -rf /var/lib/apt/lists/*

# Download and set up GitVersion
RUN set -ex \
&& wget "https://github.com/GitTools/GitVersion/releases/download/v${GITVERSION_VERSION}/GitVersion_${GITVERSION_VERSION}.zip" -O /tmp/GitVersion_${GITVERSION_VERSION}.zip \
&& mkdir -p /usr/local/GitVersion_${GITVERSION_VERSION} \
&& unzip /tmp/GitVersion_${GITVERSION_VERSION}.zip -d /usr/local/GitVersion_${GITVERSION_VERSION} \
&& rm /tmp/GitVersion_${GITVERSION_VERSION}.zip \
&& echo "mono /usr/local/GitVersion_${GITVERSION_VERSION}/GitVersion.exe /output json /showvariable \$1" >> /usr/local/bin/gitversion \
&& chmod +x /usr/local/bin/gitversion

RUN set -ex \
&& curl -fSL "https://${DOCKER_BUCKET}/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz" -o docker.tgz \
&& echo "${DOCKER_SHA256} *docker.tgz" | sha256sum -c - \
&& tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ \
&& rm docker.tgz \
&& docker -v \
# set up subuid/subgid so that "--userns-remap=default" works out-of-the-box
&& addgroup dockremap \
&& useradd -g dockremap dockremap \
&& echo 'dockremap:165536:65536' >> /etc/subuid \
&& echo 'dockremap:165536:65536' >> /etc/subgid \
&& wget "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind" -O /usr/local/bin/dind \
&& curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 > /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/dind /usr/local/bin/docker-compose \
# Ensure docker-compose works
&& docker-compose version

VOLUME /var/lib/docker

COPY dockerd-entrypoint.sh /usr/local/bin/

ENV PATH="/usr/local/bin:$PATH" \
GPG_KEY="0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D" \
PYTHON_VERSION="3.6.5" \
PYTHON_PIP_VERSION="10.0.0" \
LC_ALL=C.UTF-8 \
LANG=C.UTF-8

RUN apt-get update && apt-get install -y --no-install-recommends \
tcl-dev tk-dev \
&& rm -rf /var/lib/apt/lists/* \
\
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& (gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
|| gpg --keyserver pgp.mit.edu --recv-keys "$GPG_KEY" \
|| gpg --keyserver keyserver.ubuntu.com --recv-keys "$GPG_KEY") \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
&& rm -r "$GNUPGHOME" python.tar.xz.asc \
&& mkdir -p /usr/src/python \
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
&& rm python.tar.xz \
\
&& cd /usr/src/python \
&& ./configure \
--enable-loadable-sqlite-extensions \
--enable-shared \
&& make -j$(nproc) \
&& make install \
&& ldconfig \
\
# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
&& rm /tmp/get-pip.py \
; fi \
# 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
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
&& pip install awscli boto3 pipenv virtualenv --no-cache-dir \
# then we use "pip list" to ensure we don't have more than one pip version installed
# https://github.com/docker-library/python/pull/100
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
\
&& find /usr/local -depth \
\( \
\( -type d -a -name test -o -name tests \) \
-o \
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
\) -exec rm -rf '{}' + \
&& apt-get purge -y --auto-remove tcl-dev tk-dev \
&& rm -rf /usr/src/python ~/.cache \
&& cd /usr/local/bin \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -s idle3 idle \
&& ln -s pydoc3 pydoc \
&& ln -s python3 python \
&& ln -s python3-config python-config \
&& rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*

CMD ["python3"]

ENTRYPOINT ["dockerd-entrypoint.sh"]
23 changes: 23 additions & 0 deletions ubuntu/python/3.6.5/dockerd-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
set -e

/usr/local/bin/dockerd \
--host=unix:///var/run/docker.sock \
--host=tcp://127.0.0.1:2375 \
--storage-driver=overlay &>/var/log/docker.log &


tries=0
d_timeout=60
until docker info >/dev/null 2>&1
do
if [ "$tries" -gt "$d_timeout" ]; then
cat /var/log/docker.log
echo 'Timed out trying to connect to internal docker host.' >&2
exit 1
fi
tries=$(( $tries + 1 ))
sleep 1
done

eval "$@"

0 comments on commit 01bfc1f

Please sign in to comment.