From eb8a86d2df2f9a89557b49538f6f93d03182c15a Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Tue, 22 Feb 2022 16:01:28 -0300 Subject: [PATCH] Upgrade container to alpine 3.15 with no monit --- .gitignore | 0 Dockerfile | 13 +++++++------ conf/main.cf | 1 + conf/master.cf | 1 + conf/outclean_header_filter | 0 conf/postfix-service.sh | 8 +++----- docker-compose.yml | 8 ++++++++ monit-service.conf | 4 ---- 8 files changed, 20 insertions(+), 15 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 conf/main.cf mode change 100644 => 100755 conf/master.cf mode change 100644 => 100755 conf/outclean_header_filter create mode 100644 docker-compose.yml delete mode 100644 monit-service.conf diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/Dockerfile b/Dockerfile index 50e862c..6384328 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,14 @@ -FROM rawmind/alpine-monit:5.25-3 -MAINTAINER Fabio Rauber +FROM alpine:3.15 +LABEL MAINTAINER="Fabio Rauber " -RUN apk add --no-cache bash postfix postfix-pcre rsyslog +RUN apk add --no-cache bash postfix postfix-pcre COPY conf /etc/postfix -COPY rsyslog.conf /etc/rsyslog.conf - -COPY monit-service.conf /opt/monit/etc/conf.d VOLUME ["/var/spool/postfix"] +ENTRYPOINT ["etc/postfix/postfix-service.sh"] + +CMD [ "start" ] + EXPOSE 25 diff --git a/conf/main.cf b/conf/main.cf old mode 100644 new mode 100755 index dd2e0d9..ab4c7c6 --- a/conf/main.cf +++ b/conf/main.cf @@ -55,3 +55,4 @@ smtpd_recipient_restrictions = ############### # Extra Settings ############### +maillog_file = /dev/stdout \ No newline at end of file diff --git a/conf/master.cf b/conf/master.cf old mode 100644 new mode 100755 index 3d98491..ab2570e --- a/conf/master.cf +++ b/conf/master.cf @@ -40,3 +40,4 @@ discard unix - - n - - discard lmtp unix - - n - - lmtp anvil unix - - n - 1 anvil scache unix - - n - 1 scache +postlog unix-dgram n - n - 1 postlogd diff --git a/conf/outclean_header_filter b/conf/outclean_header_filter old mode 100644 new mode 100755 diff --git a/conf/postfix-service.sh b/conf/postfix-service.sh index 64084d7..f805f71 100755 --- a/conf/postfix-service.sh +++ b/conf/postfix-service.sh @@ -38,10 +38,8 @@ function serviceStart { serviceConf # Actually run Postfix log "[ Starting Postfix... ]" - rm -f /var/run/rsyslogd.pid - nohup /usr/lib/postfix/master & + nohup /usr/sbin/postfix start-fg & echo $! > /var/run/postfix.pid - nohup rsyslogd -n & } function serviceStop { @@ -53,10 +51,10 @@ function serviceRestart { log "[ Restarting Postfix... ]" serviceStop serviceStart - /opt/monit/bin/monit reload } export DOMAIN=${DOMAIN:-"localhost"} +export HOSTNAME=${HOSTNAME:-"localhost"} export MESSAGE_SIZE_LIMIT=${MESSAGE_SIZE_LIMIT:-"50000000"} export RELAYNETS=${RELAYNETS:-""} export RELAYHOST=${RELAYHOST:-""} @@ -73,4 +71,4 @@ case "$1" in ;; *) echo "Usage: $0 restart|start|stop" ;; -esac +esac \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..74a6e6f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '2' +services: + postfix: + build: . + ports: + - 25 + entrypoint: /bin/bash + tty: true \ No newline at end of file diff --git a/monit-service.conf b/monit-service.conf deleted file mode 100644 index e23f057..0000000 --- a/monit-service.conf +++ /dev/null @@ -1,4 +0,0 @@ -check process master with pidfile /var/run/postfix.pid - start program = "/etc/postfix/postfix-service.sh start" - stop program = "/etc/postfix/postfix-service.sh stop" - if failed port 25 type tcp for 5 cycles then exec "/opt/monit/bin/monit quit"