exherbo-dockermail/core/Dockerfile

90 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
2015-08-26 15:06:00 +00:00
# check these with "cave show <package-name>"
RUN echo -e "*/* acl bash-completion ipv6 kmod openrc pcre readline unicode\
zlib pam ssl sasl bzip2 urandom crypt tcpd\
-acpi -cairo -consolekit -cups -dbus -dri -gnome -gnutls -gtk -ogg -opengl\
-pdf -policykit -qt3support -qt5 -qt4 -sdl -sound -systemd -truetype -vim\
-vim-syntax -wayland -X\
\n\
\nnet-mail/dovecot cydir imapc maildir mbox mdbox pam pop3c sieve sqlite\
\n\
\nmail-mta/postfix dovecot-sasl mbox sasl" \
>> /etc/paludis/use.conf
2014-12-03 10:34:50 +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
2015-08-26 15:06:00 +00:00
# install dovecot
RUN chgrp paludisbuild /dev/tty && cave resolve -z net-mail/dovecot mail-mta/postfix -x
# install tools
RUN chgrp paludisbuild /dev/tty && cave resolve -z app-admin/supervisor sys-process/htop -x
# update etc files... hope this doesn't screw up
RUN etc-update --automode -5
# 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
2014-12-03 10:34:50 +00:00
ADD ./config/postfix.main.cf /etc/postfix/main.cf
2014-12-03 11:03:53 +00:00
ADD ./config/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
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
2015-07-27 10:39:32 +00:00
COPY ./config/dovecot.mail /etc/dovecot/conf.d/10-mail.conf
COPY ./config/dovecot.ssl /etc/dovecot/conf.d/10-ssl.conf
COPY ./config/dovecot.auth /etc/dovecot/conf.d/10-auth.conf
COPY ./config/dovecot.master /etc/dovecot/conf.d/10-master.conf
COPY ./config/dovecot.lda /etc/dovecot/conf.d/15-lda.conf
COPY ./config/dovecot.imap /etc/dovecot/conf.d/20-imap.conf
2015-09-14 14:05:32 +00:00
COPY ./config/dovecot.sieve /etc/dovecot/conf.d/90-sieve.conf
2015-07-08 09:06:43 +00:00
# Uncomment to add verbose logging
2015-08-26 15:06:00 +00:00
COPY ./config/dovecot.logging /etc/dovecot/conf.d/10-logging.conf
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
# create global sieve folder/rule
RUN mkdir -p /vmail/sieve && echo -e "require \"fileinto\";\
\nif header :contains \"X-Spam-Flag\" \"YES\" {\
\n fileinto \"Spam\";\
\n}" > /vmail/sieve/spam-global.sieve && \
chown -R vmail:vmail /vmail/sieve/
# Volume to store email
VOLUME ["/vmail"]
2015-07-08 09:06:43 +00:00
EXPOSE 25 143 587
2015-08-26 15:06:00 +00:00
ENTRYPOINT /boot; /usr/bin/supervisord -n