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.
This commit is contained in:
Patrick Georgi
2019-01-11 15:34:11 +01:00
parent 906dde757d
commit 561abf6fee
3 changed files with 13 additions and 10 deletions

View File

@@ -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

View File

@@ -16,7 +16,7 @@ function wait_for_postgres () {
function wait_for_mysql () {
# Check if MySQL is up and accepting connections.
HOSTNAME=$(python <<EOF
HOSTNAME=$(python3 <<EOF
try:
from urllib.parse import urlparse
except ImportError:
@@ -112,11 +112,11 @@ else
fi
# Collect static for the django installation.
python manage.py collectstatic --noinput
python3 manage.py collectstatic --noinput
# Migrate all the data to the database if this is a new installation, otherwise
# this command will upgrade the database.
python manage.py migrate
python3 manage.py migrate
# If MAILMAN_ADMIN_USER and MAILMAN_ADMIN_EMAIL is defined create a new
# superuser for Django. There is no password setup so it can't login yet unless
@@ -124,7 +124,7 @@ python manage.py migrate
if [[ -v MAILMAN_ADMIN_USER ]] && [[ -v MAILMAN_ADMIN_EMAIL ]];
then
echo "Creating admin user $MAILMAN_ADMIN_USER ..."
python manage.py createsuperuser --noinput --username "$MAILMAN_ADMIN_USER"\
python3 manage.py createsuperuser --noinput --username "$MAILMAN_ADMIN_USER"\
--email "$MAILMAN_ADMIN_EMAIL" 2> /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

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import os
import sys