From 5d0081a0ecfbed7c3c1d24bc57628af386ee0b5d Mon Sep 17 00:00:00 2001 From: andryyy Date: Fri, 23 Dec 2016 10:27:48 +0100 Subject: [PATCH] Base all on xenial to save some space loading chunks, clean-up images --- data/Dockerfiles/dovecot/Dockerfile | 39 +++++++++++++--------- data/Dockerfiles/pdns/Dockerfile | 12 +++++-- data/Dockerfiles/postfix/Dockerfile | 19 +++++++---- data/Dockerfiles/postfix/supervisord.conf | 8 ++--- data/Dockerfiles/rmilter/Dockerfile | 17 ++++++---- data/Dockerfiles/rspamd/Dockerfile | 21 +++++++----- data/Dockerfiles/sogo/Dockerfile | 7 ++++ data/Dockerfiles/sogo/docker-entrypoint.sh | 4 +++ data/conf/sogo/sieve.creds | 2 +- 9 files changed, 87 insertions(+), 42 deletions(-) diff --git a/data/Dockerfiles/dovecot/Dockerfile b/data/Dockerfiles/dovecot/Dockerfile index 88b72b6d..54a24690 100644 --- a/data/Dockerfiles/dovecot/Dockerfile +++ b/data/Dockerfiles/dovecot/Dockerfile @@ -2,22 +2,28 @@ From ubuntu:xenial MAINTAINER Andre Peters ENV DEBIAN_FRONTEND noninteractive +ENV LC_ALL C -RUN apt-get update \ - && apt-get -y install dovecot-common \ - dovecot-core \ - dovecot-imapd \ - dovecot-lmtpd \ - dovecot-managesieved \ - dovecot-sieve \ - dovecot-mysql \ - dovecot-pop3d \ - dovecot-dev \ - wget \ - curl \ - build-essential \ - autotools-dev \ - automake +RUN dpkg-divert --local --rename --add /sbin/initctl \ + && ln -sf /bin/true /sbin/initctl \ + && dpkg-divert --local --rename --add /usr/bin/ischroot \ + && ln -sf /bin/true /usr/bin/ischroot + +RUN apt-get update +RUN apt-get -y install dovecot-common \ + dovecot-core \ + dovecot-imapd \ + dovecot-lmtpd \ + dovecot-managesieved \ + dovecot-sieve \ + dovecot-mysql \ + dovecot-pop3d \ + dovecot-dev \ + wget \ + curl \ + build-essential \ + autotools-dev \ + automake WORKDIR /tmp RUN wget http://hg.dovecot.org/dovecot-antispam-plugin/archive/tip.tar.gz -O - | tar xvz \ @@ -31,6 +37,7 @@ COPY ./rspamd-pipe /usr/local/bin/rspamd-pipe COPY ./docker-entrypoint.sh / RUN chmod +x /usr/local/bin/rspamd-pipe + RUN groupadd -g 5000 vmail RUN useradd -g vmail -u 5000 vmail -d /var/vmail @@ -38,3 +45,5 @@ EXPOSE 24 10001 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["/usr/sbin/dovecot", "-F"] + +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/data/Dockerfiles/pdns/Dockerfile b/data/Dockerfiles/pdns/Dockerfile index 7a37447a..b56dcf9c 100644 --- a/data/Dockerfiles/pdns/Dockerfile +++ b/data/Dockerfiles/pdns/Dockerfile @@ -1,9 +1,15 @@ -FROM debian:jessie +FROM ubuntu:xenial MAINTAINER Andre Peters ENV DEBIAN_FRONTEND noninteractive +ENV LC_ALL C -RUN echo 'deb http://repo.powerdns.com/debian jessie-rec-40 main' > /etc/apt/sources.list.d/pdns.list +RUN dpkg-divert --local --rename --add /sbin/initctl \ + && ln -sf /bin/true /sbin/initctl \ + && dpkg-divert --local --rename --add /usr/bin/ischroot \ + && ln -sf /bin/true /usr/bin/ischroot + +RUN echo 'deb http://repo.powerdns.com/ubuntu xenial-rec-40 main' > /etc/apt/sources.list.d/pdns.list RUN echo 'Package: pdns-*\n\ Pin: origin repo.powerdns.com\n\ @@ -16,3 +22,5 @@ RUN apt-key adv --fetch-keys http://repo.powerdns.com/FD380FBB-pub.asc \ CMD ["/usr/sbin/pdns_recursor"] EXPOSE 53/udp + +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/data/Dockerfiles/postfix/Dockerfile b/data/Dockerfiles/postfix/Dockerfile index 60c33cc0..bc6015d7 100644 --- a/data/Dockerfiles/postfix/Dockerfile +++ b/data/Dockerfiles/postfix/Dockerfile @@ -2,24 +2,31 @@ From ubuntu:xenial MAINTAINER Andre Peters ENV DEBIAN_FRONTEND noninteractive +ENV LC_ALL C + +RUN dpkg-divert --local --rename --add /sbin/initctl \ + && ln -sf /bin/true /sbin/initctl \ + && dpkg-divert --local --rename --add /usr/bin/ischroot \ + && ln -sf /bin/true /usr/bin/ischroot RUN apt-get update - -RUN apt-get -y install supervisor \ +RUN apt-get install -y --no-install-recommends supervisor \ postfix \ sasl2-bin \ postfix \ postfix-mysql \ postfix-pcre \ - rsyslog \ + syslog-ng \ + syslog-ng-core \ ca-certificates +RUN sed -i -E 's/^(\s*)system\(\);/\1unix-stream("\/dev\/log");/' /etc/syslog-ng/syslog-ng.conf + COPY supervisord.conf /etc/supervisor/supervisord.conf COPY postfix.sh /opt/postfix.sh -RUN groupadd -g 5000 vmail -RUN useradd -g vmail -u 5000 vmail -d /var/vmail - EXPOSE 588 CMD exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf + +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/data/Dockerfiles/postfix/supervisord.conf b/data/Dockerfiles/postfix/supervisord.conf index f49940fd..4268899d 100644 --- a/data/Dockerfiles/postfix/supervisord.conf +++ b/data/Dockerfiles/postfix/supervisord.conf @@ -1,11 +1,11 @@ [supervisord] nodaemon=true -[program:rsyslog] -command=/usr/sbin/rsyslogd -n -autostart=true -autorestart=true +[program:syslog-ng] +command=/usr/sbin/syslog-ng --foreground --no-caps redirect_stderr=true +autostart=true +stdout_syslog=true [program:postfix] command=/opt/postfix.sh diff --git a/data/Dockerfiles/rmilter/Dockerfile b/data/Dockerfiles/rmilter/Dockerfile index 2d0d0870..9a239139 100644 --- a/data/Dockerfiles/rmilter/Dockerfile +++ b/data/Dockerfiles/rmilter/Dockerfile @@ -1,18 +1,23 @@ -FROM debian:jessie +FROM ubuntu:xenial MAINTAINER Andre Peters ENV DEBIAN_FRONTEND noninteractive +ENV LC_ALL C -RUN apt-get update \ - && apt-get install -y wget \ - && wget -O- https://rspamd.com/apt-stable/gpg.key | apt-key add - \ - && echo "deb http://rspamd.com/apt-stable/ jessie main" > /etc/apt/sources.list.d/rspamd.list \ - && echo "deb-src http://rspamd.com/apt-stable/ jessie main" >> /etc/apt/sources.list.d/rspamd.list \ +RUN dpkg-divert --local --rename --add /sbin/initctl \ + && ln -sf /bin/true /sbin/initctl \ + && dpkg-divert --local --rename --add /usr/bin/ischroot \ + && ln -sf /bin/true /usr/bin/ischroot + +RUN apt-key adv --fetch-keys http://rspamd.com/apt-stable/gpg.key \ + && echo "deb http://rspamd.com/apt-stable/ xenial main" > /etc/apt/sources.list.d/rspamd.list \ && apt-get update \ && apt-get --no-install-recommends -y --force-yes install rmilter CMD ["/usr/sbin/rmilter","-n", "-c", "/etc/rmilter.conf.d/rmilter.conf"] +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + USER _rmilter EXPOSE 9000 diff --git a/data/Dockerfiles/rspamd/Dockerfile b/data/Dockerfiles/rspamd/Dockerfile index ed43ef34..514f3104 100644 --- a/data/Dockerfiles/rspamd/Dockerfile +++ b/data/Dockerfiles/rspamd/Dockerfile @@ -1,15 +1,18 @@ -FROM debian:jessie +FROM ubuntu:xenial MAINTAINER Andre Peters ENV DEBIAN_FRONTEND noninteractive +ENV LC_ALL C -RUN apt-get update \ - && apt-get install -y wget \ - && wget -O- https://rspamd.com/apt-stable/gpg.key | apt-key add - \ - && echo "deb http://rspamd.com/apt-stable/ jessie main" > /etc/apt/sources.list.d/rspamd.list \ - && echo "deb-src http://rspamd.com/apt-stable/ jessie main" >> /etc/apt/sources.list.d/rspamd.list \ - && apt-get update \ - && apt-get --no-install-recommends -y --force-yes install rspamd +RUN dpkg-divert --local --rename --add /sbin/initctl \ + && ln -sf /bin/true /sbin/initctl \ + && dpkg-divert --local --rename --add /usr/bin/ischroot \ + && ln -sf /bin/true /usr/bin/ischroot + +RUN apt-key adv --fetch-keys http://rspamd.com/apt-stable/gpg.key \ + && echo "deb http://rspamd.com/apt-stable/ xenial main" > /etc/apt/sources.list.d/rspamd.list \ + && apt-get update \ + && apt-get --no-install-recommends -y --force-yes install rspamd RUN echo '.include $LOCAL_CONFDIR/local.d/rspamd.conf.local' > /etc/rspamd/rspamd.conf.local # "Hardcoded" - we need them @@ -17,6 +20,8 @@ RUN echo 'settings = "http://nginx:8081/settings.php";' > /etc/rspamd/modules.d/ CMD ["/usr/bin/rspamd","-f", "-u", "_rspamd", "-g", "_rspamd"] +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + USER _rspamd EXPOSE 11333 11334 diff --git a/data/Dockerfiles/sogo/Dockerfile b/data/Dockerfiles/sogo/Dockerfile index f9f55552..fdfc1b36 100644 --- a/data/Dockerfiles/sogo/Dockerfile +++ b/data/Dockerfiles/sogo/Dockerfile @@ -2,6 +2,12 @@ FROM ubuntu:xenial MAINTAINER Andre Peters ENV DEBIAN_FRONTEND noninteractive +ENV LC_ALL C + +RUN dpkg-divert --local --rename --add /sbin/initctl \ + && ln -sf /bin/true /sbin/initctl \ + && dpkg-divert --local --rename --add /usr/bin/ischroot \ + && ln -sf /bin/true /usr/bin/ischroot ENV GOSU_VERSION 1.9 RUN set -x \ @@ -30,3 +36,4 @@ EXPOSE 20000 ENTRYPOINT ["/docker-entrypoint.sh"] CMD exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/data/Dockerfiles/sogo/docker-entrypoint.sh b/data/Dockerfiles/sogo/docker-entrypoint.sh index e639c4f5..2aa2ef2b 100755 --- a/data/Dockerfiles/sogo/docker-entrypoint.sh +++ b/data/Dockerfiles/sogo/docker-entrypoint.sh @@ -1,6 +1,10 @@ #!/bin/bash set -e +until mysql -u ${DBUSER} -p${DBPASS} ${DBNAME} -e ""; do + sleep 1 +done + mkdir -p /var/lib/sogo/GNUstep/Defaults/ # Generate plist header with timezone data diff --git a/data/conf/sogo/sieve.creds b/data/conf/sogo/sieve.creds index 2ea0b29c..0c8f5fd2 100644 --- a/data/conf/sogo/sieve.creds +++ b/data/conf/sogo/sieve.creds @@ -1 +1 @@ -EEFos0swXBmY5rfy:7xKWGpXVC4w5vGNnJNa09o9X +t5sqobb5szmj0of4:7gwo90wwbvpp5lfefwwfl1vu