Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
From ubuntu:trusty
MAINTAINER Elliott Ye
FROM ubuntu:focal

# Set noninteractive mode for apt-get
ENV DEBIAN_FRONTEND noninteractive
Expand All @@ -9,10 +8,10 @@ RUN apt-get update

# Start editing
# Install package here for cache
RUN apt-get -y install supervisor postfix sasl2-bin opendkim opendkim-tools
RUN apt-get -y install postfix sasl2-bin opendkim opendkim-tools

# Add files
ADD assets/install.sh /opt/install.sh

# Run
CMD /opt/install.sh;/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
CMD /opt/install.sh;/opt/postfix.sh
25 changes: 5 additions & 20 deletions assets/install.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
#!/bin/bash

#judgement
if [[ -a /etc/supervisor/conf.d/supervisord.conf ]]; then
exit 0
fi

#supervisor
cat > /etc/supervisor/conf.d/supervisord.conf <<EOF
[supervisord]
nodaemon=true

[program:postfix]
command=/opt/postfix.sh

[program:rsyslog]
command=/usr/sbin/rsyslogd -n -c3
EOF

############
# postfix
############
cat >> /opt/postfix.sh <<EOF
#!/bin/bash
service postfix start
tail -f /var/log/mail.log
postfix start-fg
EOF

chmod +x /opt/postfix.sh
postconf -e myhostname=$maildomain
postconf -e maillog_file=/dev/stdout
postconf -e mydestination="localhost.localdomain,localhost"
postconf -F '*/*/chroot = n'

############
Expand Down Expand Up @@ -127,4 +112,4 @@ cat >> /etc/opendkim/SigningTable <<EOF
*@$maildomain mail._domainkey.$maildomain
EOF
chown opendkim:opendkim $(find /etc/opendkim/domainkeys -iname *.private)
chmod 400 $(find /etc/opendkim/domainkeys -iname *.private)
chmod 400 $(find /etc/opendkim/domainkeys -iname *.private)
3 changes: 1 addition & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/bash

docker build -t catatnight/postfix .
docker build -t catatnight/postfix .