From 05447580c7a34bec80ef9827f98e2513db4792fa Mon Sep 17 00:00:00 2001 From: Mathieu Le Marec - Pasquet Date: Wed, 7 Nov 2018 21:25:06 +0100 Subject: [PATCH] Python3 build Rels: - matrix-org/synapse#4202 - matrix-org/synapse#4191 --- .docker/IMAGES.json | 26 ++++++-- .travis.yml | 11 +++- Dockerfile.36 | 120 +++++++++++++++++++++++++++++++++++ adds/supervisord-matrix.conf | 2 +- 4 files changed, 153 insertions(+), 6 deletions(-) create mode 100644 Dockerfile.36 diff --git a/.docker/IMAGES.json b/.docker/IMAGES.json index 5ae83d5..912b323 100644 --- a/.docker/IMAGES.json +++ b/.docker/IMAGES.json @@ -1,20 +1,38 @@ { - "images": [ + "images": [ + { + "tag": "corpusops/docker-matrix:develop-py36", + "builder_type": "docker", + "dockerfile": "Dockerfile.36", + "extra_args": "--build-arg BV_SYN={img_parts[tag]}" + }, + { + "tag": "corpusops/docker-matrix:master-py36", + "builder_type": "docker", + "dockerfile": "Dockerfile.36", + "extra_args": "--build-arg BV_SYN={img_parts[tag]}" + }, + { + "tag": "corpusops/docker-matrix:v0.33.9-py36", + "builder_type": "docker", + "dockerfile": "Dockerfile.36", + "extra_args": "--build-arg BV_SYN={img_parts[tag]}" + }, { "tag": "corpusops/docker-matrix:develop", "builder_type": "docker", "extra_args": "--build-arg BV_SYN={img_parts[tag]}" - }, + }, { "tag": "corpusops/docker-matrix:master", "builder_type": "docker", "extra_args": "--build-arg BV_SYN={img_parts[tag]}" - }, + }, { "tag": "corpusops/docker-matrix:v0.33.9", "builder_type": "docker", "extra_args": "--build-arg BV_SYN={img_parts[tag]}" - }, + }, { "tag": "corpusops/docker-matrix:v0.33.8-tmpfix-4160.1", "builder_type": "docker", diff --git a/.travis.yml b/.travis.yml index 6bd79d2..680470a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,16 @@ env: sync_code="$install -C --synchronize-code --skip-sync-core" \ release="$COPS_ROOT/hacking/docker_release" \ silent_rm="$silent rm -rf" - matrix: + matrix: + - __VERSION__="develop-py36" \ + DOCKER_IMAGE="corpusops/${__NAME__}:${__VERSION__}" \ + IMAGE="dockerfile__$DOCKER_IMAGE" + - __VERSION__="master-py36" \ + DOCKER_IMAGE="corpusops/${__NAME__}:${__VERSION__}" \ + IMAGE="dockerfile__$DOCKER_IMAGE" + - __VERSION__="v0.33.9-py36" \ + DOCKER_IMAGE="corpusops/${__NAME__}:${__VERSION__}" \ + IMAGE="dockerfile__$DOCKER_IMAGE" - __VERSION__="develop" \ DOCKER_IMAGE="corpusops/${__NAME__}:${__VERSION__}" \ IMAGE="dockerfile__$DOCKER_IMAGE" diff --git a/Dockerfile.36 b/Dockerfile.36 new file mode 100644 index 0000000..7d518d3 --- /dev/null +++ b/Dockerfile.36 @@ -0,0 +1,120 @@ +FROM debian:jessie +# Git branch to build from +ARG BV_SYN=master +# use --build-arg REBUILD=$(date) to invalidate the cache and upgrade all +# packages +ARG REBUILD=0 + +VOLUME ["/data"] + +# https://github.com/python-pillow/Pillow/issues/1763 +ENV LIBRARY_PATH=/lib:/usr/lib +# user configuration +ENV MATRIX_UID=991 MATRIX_GID=991 +ENV MATRIX_URL=https://github.com/corpusops/synapse +ENV MATRIX_URL=https://github.com/matrix-org/synapse + +RUN set -ex;\ + mkdir /uploads;\ + export DEBIAN_FRONTEND=noninteractive;\ + mkdir -p /var/cache/apt/archives;\ + touch /var/cache/apt/archives/lock;\ + apt-get clean;\ + apt-get update -y;\ + apt-get install -y \ + bash \ + curl postgresql-client\ + coreutils \ + file \ + gcc \ + git \ + libevent-2.0-5 \ + libevent-dev \ + libffi-dev \ + libffi6 \ + libgnutls28-dev \ + libjpeg62-turbo \ + libjpeg62-turbo-dev \ + libldap-2.4-2 \ + libldap2-dev \ + libsasl2-dev \ + libsqlite3-dev \ + libssl-dev \ + libssl1.0.0 \ + libtool \ + libxml2 \ + libxml2-dev \ + libxslt1-dev \ + libxslt1.1 \ + linux-headers-amd64 \ + make \ + pwgen \ + python3 \ + python3-dev \ + libpq5 libpq-dev\ + sqlite \ + zlib1g \ + zlib1g-dev;\ + :;\ + curl -O https://bootstrap.pypa.io/get-pip.py;\ + python3 get-pip.py;\ + apt-get install -y \ + python-virtualenv;\ + python3 -m pip -- install --upgrade pip;\ + python3 -m pip -- install --upgrade supervisor +# Git branch to build from +RUN set -ex;\ + :;\ + git clone https://github.com/maxidor/matrix-synapse-rest-auth.git;\ + cd matrix-synapse-rest-auth;\ + for i in /usr/lib/python*/dist-packages/; do\ + cp -fv rest_auth_provider.py "$i";\ + done;\ + cd /;\ + :;\ + git clone --branch $BV_SYN --depth 1 ${MATRIX_URL}.git;\ + cd /synapse;\ + python synapse/python_dependencies.py | xargs python3 -m pip -- install --upgrade;\ + python3 -m pip -- install --upgrade python-ldap;\ + python3 -m pip -- install --upgrade enum34;\ + python3 -m pip -- install --upgrade ipaddress;\ + python3 -m pip -- install --upgrade lxml;\ + python3 -m pip -- install --upgrade --process-dependency-links .;\ + GIT_SYN=$(git ls-remote ${MATRIX_URL} $BV_SYN | cut -f 1);\ + echo "synapse: $BV_SYN ($GIT_SYN)" >> /synapse.version;\ + cd /;\ + rm -rf /synapse;\ + :;\ + apt-get autoremove -y \ + file \ + gcc \ + git \ + libevent-dev \ + libffi-dev \ + libjpeg62-turbo-dev \ + libldap2-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libpq-dev \ + libxml2-dev \ + libxslt1-dev \ + linux-headers-amd64 \ + make \ + python-dev \ + zlib1g-dev;\ + :;\ + apt-get autoremove -y ;\ + rm -rf /var/lib/apt/* /var/cache/apt/* + +# install homerserver template +COPY adds/start.sh /start.sh +# add supervisor configs +COPY adds/supervisord-matrix.conf /conf/ +COPY adds/supervisord.conf / + +# startup configuration +ENTRYPOINT ["/start.sh"] +CMD ["start"] +EXPOSE 8448 + diff --git a/adds/supervisord-matrix.conf b/adds/supervisord-matrix.conf index d1e7f2b..5c4d04f 100644 --- a/adds/supervisord-matrix.conf +++ b/adds/supervisord-matrix.conf @@ -4,4 +4,4 @@ stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 user=matrix -command=/usr/bin/python -m synapse.app.homeserver --config-path /data/homeserver.yaml +command=/usr/bin/python3 -m synapse.app.homeserver --config-path /data/homeserver.yaml