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:
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.6-alpine3.7
|
FROM alpine:3.8
|
||||||
|
|
||||||
MAINTAINER Abhilash Raj
|
MAINTAINER Abhilash Raj
|
||||||
|
|
||||||
@@ -12,11 +12,12 @@ COPY docker-entrypoint.sh /usr/local/bin/
|
|||||||
# rights for management script
|
# rights for management script
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers \
|
&& 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 \
|
&& apk add --no-cache --virtual .mailman-rundeps bash sassc \
|
||||||
postgresql-client mysql-client py-mysqldb curl mailcap \
|
postgresql-client mysql-client py-mysqldb curl mailcap \
|
||||||
&& pip install -U django==2.1.5 pip \
|
python3 py3-setuptools \
|
||||||
&& pip install mailmanclient==3.2.1 \
|
&& python3 -m pip install -U django==2.1.5 pip \
|
||||||
|
&& python3 -m pip install mailmanclient==3.2.1 \
|
||||||
postorius==1.2.2 \
|
postorius==1.2.2 \
|
||||||
hyperkitty==1.2.1 \
|
hyperkitty==1.2.1 \
|
||||||
django-mailman3==1.2.0 \
|
django-mailman3==1.2.0 \
|
||||||
@@ -43,3 +44,5 @@ STOPSIGNAL SIGINT
|
|||||||
|
|
||||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
CMD ["uwsgi", "--ini", "/opt/mailman-web/uwsgi.ini"]
|
CMD ["uwsgi", "--ini", "/opt/mailman-web/uwsgi.ini"]
|
||||||
|
|
||||||
|
ENV PYTHONPATH=/usr/lib/python3.6/site-packages
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function wait_for_postgres () {
|
|||||||
|
|
||||||
function wait_for_mysql () {
|
function wait_for_mysql () {
|
||||||
# Check if MySQL is up and accepting connections.
|
# Check if MySQL is up and accepting connections.
|
||||||
HOSTNAME=$(python <<EOF
|
HOSTNAME=$(python3 <<EOF
|
||||||
try:
|
try:
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -112,11 +112,11 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect static for the django installation.
|
# 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
|
# Migrate all the data to the database if this is a new installation, otherwise
|
||||||
# this command will upgrade the database.
|
# 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
|
# 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
|
# 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 ]];
|
if [[ -v MAILMAN_ADMIN_USER ]] && [[ -v MAILMAN_ADMIN_EMAIL ]];
|
||||||
then
|
then
|
||||||
echo "Creating admin user $MAILMAN_ADMIN_USER ..."
|
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 || \
|
--email "$MAILMAN_ADMIN_EMAIL" 2> /dev/null || \
|
||||||
echo "Superuser $MAILMAN_ADMIN_USER already exists"
|
echo "Superuser $MAILMAN_ADMIN_USER already exists"
|
||||||
fi
|
fi
|
||||||
@@ -134,7 +134,7 @@ fi
|
|||||||
if [[ -v SERVE_FROM_DOMAIN ]];
|
if [[ -v SERVE_FROM_DOMAIN ]];
|
||||||
then
|
then
|
||||||
echo "Setting $SERVE_FROM_DOMAIN as the default domain ..."
|
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')"
|
"from django.contrib.sites.models import Site; Site.objects.filter(domain='example.com').update(domain='$SERVE_FROM_DOMAIN', name='$SERVE_FROM_DOMAIN')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user