exherbo-dockermail/core/Dockerfile

99 lines
3.1 KiB
Docker
Raw Normal View History

FROM hasufell/gentoo-amd64-paludis:latest
2015-08-26 15:06:00 +00:00
MAINTAINER Julian Ospald "hasufell@posteo.de"
2014-12-03 10:34:50 +00:00
##### PACKAGE INSTALLATION #####
# copy paludis config
COPY ./config/paludis /etc/paludis
2015-10-01 13:57:36 +00:00
2015-08-26 15:06:00 +00:00
# update world with our USE flags
RUN chgrp paludisbuild /dev/tty && cave resolve -c world -x
2014-12-03 10:34:50 +00:00
# install mail set
RUN chgrp paludisbuild /dev/tty && cave resolve -c mail -x
2015-08-26 15:06:00 +00:00
# install tools set
RUN chgrp paludisbuild /dev/tty && cave resolve -c tools -x
2015-08-26 15:06:00 +00:00
# update etc files... hope this doesn't screw up
RUN etc-update --automode -5
################################
##### APPLICATION CONFIG #####
2015-08-26 15:06:00 +00:00
# create dovecot certificates
RUN mkdir -p /var/tmp/dovecot-cert
RUN cp /usr/share/doc/dovecot-*/mkcert.sh /var/tmp/dovecot-cert/ ; \
cp /usr/share/doc/dovecot-*/dovecot-openssl.cnf /var/tmp/dovecot-cert/
RUN chmod +x /var/tmp/dovecot-cert/mkcert.sh
WORKDIR /var/tmp/dovecot-cert
RUN ./mkcert.sh
RUN chown root:dovecot /etc/ssl/certs/dovecot.pem ; \
chmod 0644 /etc/ssl/certs/dovecot.pem ; \
chown root:dovecot /etc/ssl/private/dovecot.pem ; \
chmod 0600 /etc/ssl/private/dovecot.pem
WORKDIR /
RUN rm -r /var/tmp/dovecot-cert
# create postfix certificates
RUN openssl req -new -x509 -nodes -out /etc/ssl/certs/postfix.pem -keyout \
/etc/ssl/private/postfix.key -days 3650 -subj '/CN=www.example.com'
2015-08-24 22:56:38 +00:00
2015-07-08 12:17:04 +00:00
# Postfix configuration
ADD ./config/postfix/postfix.main.cf /etc/postfix/main.cf
ADD ./config/postfix/postfix.master.cf.append /etc/postfix/master-additional.cf
2014-12-03 10:34:50 +00:00
RUN cat /etc/postfix/master-additional.cf >> /etc/postfix/master.cf
RUN sed -r -i -e \
'/^smtp[[:space:]]+inet[[:space:]]+/a\ -o content_filter=spamassassin' \
/etc/postfix/master.cf
2015-08-27 00:19:49 +00:00
RUN newaliases -oA/etc/mail/aliases
2014-12-03 10:34:50 +00:00
2015-07-08 12:17:04 +00:00
# Dovecot configuration
COPY ./config/dovecot/dovecot.mail /etc/dovecot/conf.d/10-mail.conf
COPY ./config/dovecot/dovecot.ssl /etc/dovecot/conf.d/10-ssl.conf
COPY ./config/dovecot/dovecot.auth /etc/dovecot/conf.d/10-auth.conf
COPY ./config/dovecot/dovecot.master /etc/dovecot/conf.d/10-master.conf
COPY ./config/dovecot/dovecot.lda /etc/dovecot/conf.d/15-lda.conf
COPY ./config/dovecot/dovecot.imap /etc/dovecot/conf.d/20-imap.conf
COPY ./config/dovecot/dovecot.sieve /etc/dovecot/conf.d/90-sieve.conf
COPY ./config/dovecot/dovecot.managesieve \
/etc/dovecot/conf.d/20-managesieve.conf
2015-07-08 09:06:43 +00:00
# Uncomment to add verbose logging
COPY ./config/dovecot/dovecot.logging /etc/dovecot/conf.d/10-logging.conf
# spamassasin configuration
COPY ./config/spamassasin/spamassasin.local.append \
/etc/spamassassin/local.cf.append
RUN mkdir /etc/spamassassin/.pyzor /etc/spamassassin/.razor
COPY ./config/spamassasin/pyzor.servers /etc/spamassassin/.pyzor/servers
RUN cat /etc/spamassassin/local.cf.append >> /etc/spamassassin/local.cf
# supervisord configuration
2015-08-26 15:06:00 +00:00
COPY ./config/supervisord.conf /etc/supervisord.conf
2014-12-03 10:34:50 +00:00
##############################
2015-07-08 12:17:04 +00:00
# Nice place for your settings
VOLUME ["/mail_settings"]
# Copy boot scripts
2015-07-08 12:17:04 +00:00
COPY boot /
RUN chmod 755 /boot
COPY boot.d /boot.d
RUN chmod -R 755 /boot.d
2015-07-08 12:17:04 +00:00
2015-08-26 15:06:00 +00:00
# Add user vmail that owns mail
2015-07-08 12:17:04 +00:00
RUN groupadd -g 5000 vmail
RUN useradd -g vmail -u 5000 vmail -d /vmail -m
2015-09-14 14:05:32 +00:00
# Volume to store email
VOLUME ["/vmail"]
2015-10-01 13:57:36 +00:00
EXPOSE 25 143 587 4190
2015-08-26 15:06:00 +00:00
CMD /boot && exec /usr/bin/supervisord -n -c /etc/supervisord.conf