First try of gentoo version

This commit is contained in:
hasufell 2015-08-26 17:06:00 +02:00
parent 7e47e457ac
commit 4c241564f0
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
5 changed files with 63 additions and 50 deletions

View File

@ -1,19 +1,46 @@
FROM ubuntu:14.10
FROM gentoo-amd64-paludis:latest
MAINTAINER Julian Ospald "hasufell@posteo.de"
ENV DEBIAN_FRONTEND noninteractive
RUN locale-gen en_GB en_GB.UTF-8 && dpkg-reconfigure locales
# 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
# Prerequisites
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
apt-get update && apt-get install -y \
ssl-cert \
postfix \
dovecot-imapd && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# update world with our USE flags
RUN chgrp paludisbuild /dev/tty && cave resolve -c world -x
# install nano
RUN apt-get update && apt-get install -y nano
# 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'
# Postfix configuration
ADD ./config/postfix.main.cf /etc/postfix/main.cf
@ -28,8 +55,8 @@ 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
# Uncomment to add verbose logging
# COPY ./config/dovecot.logging /etc/dovecot/conf.d/10-logging.conf
COPY ./config/rsyslog.conf /etc/rsyslog.conf
COPY ./config/dovecot.logging /etc/dovecot/conf.d/10-logging.conf
COPY ./config/supervisord.conf /etc/supervisord.conf
# Nice place for your settings
VOLUME ["/mail_settings"]
@ -43,9 +70,10 @@ RUN chmod -R 755 /boot.d
# Volume to store email
VOLUME ["/vmail"]
# Add user vmail that ownes mail
# Add user vmail that owns mail
RUN groupadd -g 5000 vmail
RUN useradd -g vmail -u 5000 vmail -d /vmail -m
EXPOSE 25 143 587
ENTRYPOINT /boot; service postfix start; service dovecot start; rsyslogd -n
ENTRYPOINT /boot; /usr/bin/supervisord -n

View File

@ -1,5 +1,5 @@
ssl = yes
disable_plaintext_auth = no
ssl_cert = </etc/dovecot/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.pem
disable_plaintext_auth = yes
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem

View File

@ -19,8 +19,8 @@ append_dot_mydomain = no
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_cert_file=/etc/ssl/certs/postfix.pem
smtpd_tls_key_file=/etc/ssl/private/postfix.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

View File

@ -1,28 +0,0 @@
# /etc/rsyslog.conf Configuration file for rsyslog.
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf
#################
#### MODULES ####
#################
$ModLoad imuxsock # provides support for local system logging
###########################
#### GLOBAL DIRECTIVES ####
###########################
# Filter duplicated messages
$RepeatedMsgReduction on
#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog
# Write everything to stdout
$template fmt,"%timestamp:::date-rfc3164%\n"
*.* /dev/stdout

View File

@ -0,0 +1,13 @@
[supervisord]
nodaemon=true
[program:postfix]
process_name=master
directory=/etc/postfix
command=/usr/sbin/postfix -c /etc/postfix start
startsecs=0
autorestart=true
[program:dovecot]
command=/usr/sbin/dovecot -c /etc/dovecot/dovecot.conf -F
autorestart=true