From 27bdbf6ae5e533d6dfa35c1e08c8a22363a4a8a4 Mon Sep 17 00:00:00 2001
From: pierreozoux <pierre@ozoux.net>
Date: Mon, 16 Feb 2015 16:30:30 +0000
Subject: [PATCH] Reorganises postfix install script

---
 dockerfiles/email/postfix/Dockerfile |  6 ++++--
 dockerfiles/email/postfix/install.sh | 20 ++++++--------------
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/dockerfiles/email/postfix/Dockerfile b/dockerfiles/email/postfix/Dockerfile
index bc16164..46142f1 100644
--- a/dockerfiles/email/postfix/Dockerfile
+++ b/dockerfiles/email/postfix/Dockerfile
@@ -14,10 +14,12 @@ RUN apt-get update \
 		supervisor \
 	&& rm -rf /var/lib/apt/lists/*
 
-COPY install.sh /opt/install.sh
+COPY install.sh install.sh
+
+RUN chmod 755 /install.sh
 
 VOLUME ["/etc/postfix", "/var/spool/mail", "/var/log"]
 
 EXPOSE 25
 
-CMD /opt/install.sh;/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
+CMD /install.sh;/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
diff --git a/dockerfiles/email/postfix/install.sh b/dockerfiles/email/postfix/install.sh
index 8a43b60..194b1d3 100755
--- a/dockerfiles/email/postfix/install.sh
+++ b/dockerfiles/email/postfix/install.sh
@@ -11,25 +11,15 @@ cat > /etc/supervisor/conf.d/supervisord.conf <<EOF
 nodaemon=true
 
 [program:postfix]
-command=/opt/postfix.sh
+process_name = master
+command = /etc/init.d/postfix start
+startsecs = 0
+autorestart = false
 
 [program:rsyslog]
 command=/usr/sbin/rsyslogd -n
 EOF
 
-############
-# postfix
-############
-cat >> /opt/postfix.sh <<EOF
-#!/bin/bash
-service postfix start
-touch /var/log/mail.log
-tail -f /var/log/mail.log
-postmap /etc/postfix/virtual
-service postfix restart
-EOF
-chmod +x /opt/postfix.sh
-
 # put the same FQDN in /data/hostname and in reverse DNS
 # for the public IP address on which this server will be
 # receiving smtp traffic.
@@ -46,3 +36,5 @@ cp /data/forwards /etc/postfix/virtual
 # accept mails from docker networked machines:
 /usr/sbin/postconf -e "mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.17.42.0/24"
 
+# configure virtual
+postmap /etc/postfix/virtual
-- 
GitLab