WIP: more work on the docker structure, still not finished with 4_run

1_base: builds a base image, based on Ubuntu 16.10
2_buildpy: builds two images:
	2a: an image that can build Python 3.6
	2b: an image that contains the built Python 3.6 in /opt/python
3_buildwheels: builds an image to build wheel files, puts them in ../4_run
4_run: the production runtime image, which can't build anything and just runs.
This commit is contained in:
2017-03-07 22:41:05 +01:00
parent af14910fa9
commit d7e4995cfa
20 changed files with 150 additions and 119 deletions

View File

@@ -0,0 +1 @@
b0c5f904f685e32d9232f7bdcbece9819a892929063b6e385414ad2dd6a23622 Python-3.6.0.tar.xz

39
docker/2_buildpy/build.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -e
# macOS does not support readlink -f, so we use greadlink instead
if [ $(uname) == 'Darwin' ]; then
command -v greadlink 2>/dev/null 2>&1 || { echo >&2 "Install greadlink using brew."; exit 1; }
readlink='greadlink'
else
readlink='readlink'
fi
PYTHONTARGET=$($readlink -f ./python)
mkdir -p "$PYTHONTARGET"
echo "Python will be built to $PYTHONTARGET"
docker build -t pillar_build -f buildpy.docker .
# Use the docker image to build Python 3.6.
GID=$(id --group)
docker run --rm -i \
-v "$PYTHONTARGET:/opt/python" \
pillar_build <<EOT
set -e
cd \$PYTHONSOURCE
./configure \
--prefix=/opt/python \
--enable-ipv6 \
--enable-shared \
--with-ensurepip=upgrade
make -j8 install
chown -R $UID:$GID /opt/python/*
EOT
# Create another docker image which contains the actual Python.
# This one will serve as base for the Wheel builder and the
# production image.
docker build -t pillar_py:3.6 -f includepy.docker .

View File

@@ -0,0 +1,23 @@
FROM pillar_base
MAINTAINER Sybren A. Stüvel <sybren@blender.studio>
RUN sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list && \
apt-get update && \
apt-get install -qy \
build-essential \
checkinstall \
curl
RUN apt-get build-dep -y python3.5
ADD Python-3.6.0.tar.xz.sha256 /Python-3.6.0.tar.xz.sha256
RUN curl -O https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
RUN sha256sum -c Python-3.6.0.tar.xz.sha256
RUN tar xf Python-3.6.0.tar.xz
RUN rm Python-3.6.0.tar.xz
# To be able to install Python outside the docker.
VOLUME /opt/python
ENV PYTHONSOURCE=/Python-3.6.0

View File

@@ -0,0 +1,9 @@
FROM pillar_base
MAINTAINER Sybren A. Stüvel <sybren@blender.studio>
ADD python /opt/python
RUN echo /opt/python/lib > /etc/ld.so.conf.d/python.conf
RUN ldconfig
RUN echo Python is installed in /opt/python/ > README.python
ENV PATH=/opt/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin