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:
39
docker/2_buildpy/build.sh
Executable file
39
docker/2_buildpy/build.sh
Executable 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 .
|
Reference in New Issue
Block a user