From e08686256708076c363dc12e63eb1d57598dd663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 8 Mar 2017 12:32:54 +0100 Subject: [PATCH] WIP: building mod_wsgi against Python 3.6 The module is included in the built Python directory, in /opt/python/mod-wsgi/mod_wsgi.so --- docker/1_base/base.docker | 2 -- docker/2_buildpy/build.sh | 14 ++++++++++++-- docker/2_buildpy/buildpy.docker | 22 +++++++++++++++++----- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/docker/1_base/base.docker b/docker/1_base/base.docker index 66865f2..c76838b 100644 --- a/docker/1_base/base.docker +++ b/docker/1_base/base.docker @@ -5,5 +5,3 @@ RUN apt-get update RUN apt-get install -qyy \ -o APT::Install-Recommends=false -o APT::Install-Suggests=false \ openssl ca-certificates - -RUN mkdir -p /data/git/pillar /data/config /data/venv /data/wheelhouse diff --git a/docker/2_buildpy/build.sh b/docker/2_buildpy/build.sh index 9c119e7..00e982a 100755 --- a/docker/2_buildpy/build.sh +++ b/docker/2_buildpy/build.sh @@ -17,7 +17,7 @@ echo "Python will be built to $PYTHONTARGET" docker build -t pillar_build -f buildpy.docker . -# Use the docker image to build Python 3.6. +# Use the docker image to build Python 3.6 and mod-wsgi GID=$(id --group) docker run --rm -i \ -v "$PYTHONTARGET:/opt/python" \ @@ -30,6 +30,17 @@ cd \$PYTHONSOURCE --enable-shared \ --with-ensurepip=upgrade make -j8 install + +# Make sure we can run Python +ldconfig + +# Build mod-wsgi-py3 for Python 3.6 +cd /dpkg/mod-wsgi-* +./configure --with-python=/opt/python/bin/python3 +make -j8 install +mkdir -p /opt/python/mod-wsgi +cp /usr/lib/apache2/modules/mod_wsgi.so /opt/python/mod-wsgi + chown -R $UID:$GID /opt/python/* EOT @@ -41,7 +52,6 @@ find $PYTHONTARGET/lib -name '*.so.*' -o -name '*.so' | while read libname; do strip "$libname" done - # Create another docker image which contains the actual Python. # This one will serve as base for the Wheel builder and the # production image. diff --git a/docker/2_buildpy/buildpy.docker b/docker/2_buildpy/buildpy.docker index c637e90..d7573f6 100644 --- a/docker/2_buildpy/buildpy.docker +++ b/docker/2_buildpy/buildpy.docker @@ -1,10 +1,11 @@ FROM pillar_base -MAINTAINER Sybren A. Stüvel +LABEL maintainer Sybren A. Stüvel RUN sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list && \ apt-get update && \ apt-get install -qy \ build-essential \ + apache2-dev \ checkinstall \ curl @@ -12,12 +13,23 @@ 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 +# Install Python sources +RUN curl -O https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz && \ + sha256sum -c Python-3.6.0.tar.xz.sha256 && \ + tar xf Python-3.6.0.tar.xz && \ + rm -v Python-3.6.0.tar.xz + +# Install mod-wsgi sources +RUN mkdir -p /dpkg && cd /dpkg && apt-get source libapache2-mod-wsgi-py3 # To be able to install Python outside the docker. VOLUME /opt/python +# To be able to run Python; after building, ldconfig has to be re-run to do this. +# This makes it easier to use Python right after building (for example to build +# mod-wsgi for Python 3.6). +RUN echo /opt/python/lib > /etc/ld.so.conf.d/python.conf +RUN ldconfig +ENV PATH=/opt/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + ENV PYTHONSOURCE=/Python-3.6.0