From 561abf6fee4e9e90d4dc8169c777e2337411f377 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 11 Jan 2019 15:34:11 +0100 Subject: [PATCH] Use standard alpine image as base for mailman-web This way we can depend on alpine's python3 package which is binary compatible with the rest of the python packages in the distribution. This requires spelling out python3 explicitly in several places since alpine still defaults to python 2 for /usr/bin/python. --- web/Dockerfile | 11 +++++++---- web/docker-entrypoint.sh | 10 +++++----- web/mailman-web/manage.py | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index 2f8a75c..84f77cd 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.6-alpine3.7 +FROM alpine:3.8 MAINTAINER Abhilash Raj @@ -12,11 +12,12 @@ COPY docker-entrypoint.sh /usr/local/bin/ # rights for management script RUN set -ex \ && apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers \ - postgresql-dev mariadb-dev \ + postgresql-dev mariadb-dev python3-dev \ && apk add --no-cache --virtual .mailman-rundeps bash sassc \ postgresql-client mysql-client py-mysqldb curl mailcap \ - && pip install -U django==2.1.5 pip \ - && pip install mailmanclient==3.2.1 \ + python3 py3-setuptools \ + && python3 -m pip install -U django==2.1.5 pip \ + && python3 -m pip install mailmanclient==3.2.1 \ postorius==1.2.2 \ hyperkitty==1.2.1 \ django-mailman3==1.2.0 \ @@ -43,3 +44,5 @@ STOPSIGNAL SIGINT ENTRYPOINT ["docker-entrypoint.sh"] CMD ["uwsgi", "--ini", "/opt/mailman-web/uwsgi.ini"] + +ENV PYTHONPATH=/usr/lib/python3.6/site-packages diff --git a/web/docker-entrypoint.sh b/web/docker-entrypoint.sh index 69111f4..b8ef5d8 100755 --- a/web/docker-entrypoint.sh +++ b/web/docker-entrypoint.sh @@ -16,7 +16,7 @@ function wait_for_postgres () { function wait_for_mysql () { # Check if MySQL is up and accepting connections. - HOSTNAME=$(python < /dev/null || \ echo "Superuser $MAILMAN_ADMIN_USER already exists" fi @@ -134,7 +134,7 @@ fi if [[ -v SERVE_FROM_DOMAIN ]]; then echo "Setting $SERVE_FROM_DOMAIN as the default domain ..." - python manage.py shell -c \ + python3 manage.py shell -c \ "from django.contrib.sites.models import Site; Site.objects.filter(domain='example.com').update(domain='$SERVE_FROM_DOMAIN', name='$SERVE_FROM_DOMAIN')" fi diff --git a/web/mailman-web/manage.py b/web/mailman-web/manage.py index f9726f9..4eb6f34 100755 --- a/web/mailman-web/manage.py +++ b/web/mailman-web/manage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys