exherbo-dockermail/Dockerfile

116 lines
3.7 KiB
Docker
Raw Normal View History

2016-10-15 11:45:24 +00:00
FROM hasufell/exherbo
2015-08-26 15:06:00 +00:00
MAINTAINER Julian Ospald "hasufell@posteo.de"
2014-12-03 10:34:50 +00:00
# copy paludis config
COPY ./config/paludis /etc/paludis
2015-10-01 13:57:36 +00:00
2015-08-26 15:06:00 +00:00
2016-10-15 11:45:24 +00:00
##### PACKAGE INSTALLATION #####
# update world with our options
RUN chgrp paludisbuild /dev/tty && \
eclectic env update && \
source /etc/profile && \
cave sync && \
cave resolve -z -1 repository/net -x && \
cave resolve -z -1 repository/hasufell -x && \
cave resolve -z -1 repository/python -x && \
cave resolve -z -1 repository/perl -x && \
cave resolve -z -1 repository/nicoo -x && \
cave update-world -s mail && \
cave resolve -ks -Sa -sa -B world -x -f --permit-old-version '*/*' && \
cave resolve -ks -Sa -sa -B world -x --permit-old-version '*/*' && \
cave purge -x && \
cave fix-linkage -x && \
rm -rf /usr/portage/distfiles/*
RUN eclectic config accept-all
2015-08-26 15:06:00 +00:00
################################
##### APPLICATION CONFIG #####
2016-10-15 12:38:38 +00:00
# copy "mailbase" stuff
COPY ./config/mailcap /etc/mailcap
COPY ./config/mail /etc/mail
COPY ./config/pam.d /etc/pam.d
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
2016-10-15 13:03:23 +00:00
COPY ./config/dovecot/dovecot.conf /etc/dovecot/dovecot.conf
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 \
2017-03-11 12:27:28 +00:00
/etc/mail/spamassassin/local.cf.append
RUN mkdir /etc/mail/spamassassin/.pyzor /etc/mail/spamassassin/.razor
COPY ./config/spamassasin/pyzor.servers /etc/mail/spamassassin/.pyzor/servers
RUN cat /etc/mail/spamassassin/local.cf.append >> /etc/mail/spamassassin/local.cf
2016-10-15 16:55:52 +00:00
COPY ./update-spamlists /usr/bin/update-spamlists
RUN chmod +x /usr/bin/update-spamlists
# 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"]
2016-10-12 11:23:59 +00:00
EXPOSE 25 465 993 4190
2015-08-26 15:06:00 +00:00
CMD /boot && exec /usr/bin/supervisord -n -c /etc/supervisord.conf