Fixing Postorius only container image (#360)

* Fixing Postorius
* Getting rid of django_compressor from STATICFILES_FINDERS
This commit is contained in:
Danil Smirnov
2020-01-08 21:13:02 +02:00
committed by Abhilash Raj
parent 973169262b
commit 5ec6bd054f
3 changed files with 13 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
FROM python:3.6-alpine
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 libffi-dev \
&& apk add --no-cache --virtual .mailman-rundeps bash libffi \
postgresql-client mysql-client py-mysqldb curl mailcap \
&& pip install -U 'Django<3.0' pip \
&& pip install postorius==1.3.1 \
postgresql-dev mariadb-dev python3-dev libffi-dev \
&& apk add --no-cache --virtual .mailman-rundeps bash sassc \
postgresql-client mysql-client py-mysqldb curl mailcap \
python3 py3-setuptools libffi \
&& python3 -m pip install -U 'Django<3.0' pip \
&& python3 -mpip install postorius==1.3.1 \
uwsgi \
psycopg2 \
dj-database-url \

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:
@@ -106,17 +106,18 @@ fi
if [[ -e /opt/mailman-web-data/settings_local.py ]]; then
echo "Copying settings_local.py ..."
cp /opt/mailman-web-data/settings_local.py /opt/mailman-web/settings_local.py
chown mailman:mailman /opt/mailman-web/settings_local.py
else
echo "settings_local.py not found, it is highly recommended that you provide one"
echo "Using default configuration to run."
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 +125,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 +135,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

@@ -194,7 +194,6 @@ STATIC_URL = '/static/'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)