Merge pull request #104 from ishitatsuyuki/alpine
Several changes: - Move mailman-web image to python2.7:alpine-3.6 image, which is built on top of apline3.6 and contains the last remaining dependency that wasn't available in 3.5. - Rename the entrypoint scripts in both core and web to docker-entrypoint.sh, and add them to somewhere on PATH so it is easy to call them in ENTRYPOINT - Move to `sassc` for django-compressor. - Set uwsgi uid/gid to string `mailman` - Use alpine image for postgres database thanks to @ishitatsuyuki !
This commit is contained in:
@@ -3,7 +3,7 @@ FROM python:3.6-alpine
|
||||
MAINTAINER Abhilash Raj
|
||||
|
||||
#Add startup script to container
|
||||
ADD assets/run.sh /opt/run.sh
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
#Install all required packages, add user for executing mailman and set execution rights for startup script
|
||||
RUN apk update \
|
||||
@@ -12,8 +12,7 @@ RUN apk update \
|
||||
&& pip install psycopg2 mailman==3.1.0 mailman-hyperkitty==1.1.0 \
|
||||
&& pip install pymysql \
|
||||
&& apk del build-deps \
|
||||
&& adduser -S mailman \
|
||||
&& chmod a+x /opt/run.sh
|
||||
&& adduser -S mailman
|
||||
|
||||
# Change the working directory.
|
||||
WORKDIR /opt/mailman
|
||||
@@ -23,5 +22,5 @@ EXPOSE 8001 8024
|
||||
|
||||
ENV MAILMAN_CONFIG_FILE /etc/mailman.cfg
|
||||
|
||||
ENTRYPOINT ["/opt/run.sh"]
|
||||
CMD ["/usr/local/bin/master"]
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD ["master"]
|
||||
|
||||
@@ -45,7 +45,7 @@ services:
|
||||
POSTGRES_USER: mailman
|
||||
POSTGRES_PASSWORD: mailmanpass
|
||||
restart: always
|
||||
image: postgres:9.6
|
||||
image: postgres:9.6-alpine
|
||||
volumes:
|
||||
- /opt/mailman/database:/var/lib/postgresql/data
|
||||
networks:
|
||||
|
||||
@@ -1,34 +1,32 @@
|
||||
FROM python:2.7
|
||||
FROM python:2.7-alpine3.6
|
||||
|
||||
MAINTAINER Abhilash Raj
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
# Add needed files for uwsgi server + settings for django
|
||||
ADD mailman-web /opt/mailman-web
|
||||
# Add needed files for uwsgi server + settings for django
|
||||
COPY mailman-web /opt/mailman-web
|
||||
# Add startup script to container
|
||||
ADD assets/run.sh /opt/run.sh
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
# Install packages and dependencies for postorius and hyperkitty
|
||||
# Add user for executing apps, change ownership for uwsgi+django files and set execution rights for management script
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ruby-sass \
|
||||
wget \
|
||||
postgresql-client \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& python -m pip install -U mailmanclient==3.1.0 \
|
||||
postorius==1.1.0 \
|
||||
hyperkitty==1.1.0 \
|
||||
django-mailman3==1.1.0 \
|
||||
whoosh \
|
||||
uwsgi \
|
||||
psycopg2 \
|
||||
dj-database-url \
|
||||
pymysql \
|
||||
&& python -m pip install -U django==1.10 \
|
||||
&& useradd -M -U -u 1000 mailman \
|
||||
&& chmod u+x /opt/run.sh \
|
||||
&& chown mailman /opt/mailman-web/* \
|
||||
&& chmod u+x /opt/mailman-web/manage.py
|
||||
RUN set -ex \
|
||||
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers postgresql-dev \
|
||||
&& apk add --no-cache --virtual .mailman-rundeps bash sassc postgresql-client \
|
||||
&& pip install -U mailmanclient==3.1.0 \
|
||||
postorius==1.1.0 \
|
||||
hyperkitty==1.1.0 \
|
||||
django-mailman3==1.1.0 \
|
||||
whoosh \
|
||||
uwsgi \
|
||||
psycopg2 \
|
||||
dj-database-url \
|
||||
pymysql \
|
||||
&& pip install -U django==1.10 \
|
||||
&& apk del --no-cache .build-deps \
|
||||
&& addgroup -S mailman \
|
||||
&& adduser -S -G mailman mailman \
|
||||
&& chown -R mailman /opt/mailman-web/ \
|
||||
&& chmod u+x /opt/mailman-web/manage.py
|
||||
|
||||
WORKDIR /opt/mailman-web
|
||||
|
||||
@@ -38,5 +36,5 @@ EXPOSE 8000 8080
|
||||
# Use stop signal for uwsgi server
|
||||
STOPSIGNAL SIGINT
|
||||
|
||||
ENTRYPOINT ["/opt/run.sh"]
|
||||
CMD ["uwsgi", "--ini", "/opt/mailman-web/uwsgi.ini"]
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD ["uwsgi", "--ini", "/opt/mailman-web/uwsgi.ini"]
|
||||
|
||||
@@ -281,8 +281,8 @@ SOCIALACCOUNT_PROVIDERS = {
|
||||
#
|
||||
COMPRESS_PRECOMPILERS = (
|
||||
('text/less', 'lessc {infile} {outfile}'),
|
||||
('text/x-scss', 'sass -t compressed {infile} {outfile}'),
|
||||
('text/x-sass', 'sass -t compressed {infile} {outfile}'),
|
||||
('text/x-scss', 'sassc -t compressed {infile} {outfile}'),
|
||||
('text/x-sass', 'sassc -t compressed {infile} {outfile}'),
|
||||
)
|
||||
|
||||
# On a production setup, setting COMPRESS_OFFLINE to True will bring a
|
||||
|
||||
@@ -18,8 +18,8 @@ process = 2
|
||||
threads = 2
|
||||
|
||||
# Drop privielges and don't run as root.
|
||||
uid = 1000
|
||||
gid = 1000
|
||||
uid = mailman
|
||||
gid = mailman
|
||||
|
||||
# Setup the django_q related worker processes.
|
||||
attach-daemon = ./manage.py qcluster
|
||||
|
||||
Reference in New Issue
Block a user