Integrate postfix into basic
This commit is contained in:
parent
b8bb87390f
commit
30e2232b71
8
basic.sh
8
basic.sh
@ -4,7 +4,7 @@ set -e
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/basic
|
||||
|
||||
# Install packages
|
||||
apk --no-cache add curl bridge e2fsprogs-extra gettext iptables kbd-misc libcap libressl libseccomp python3 py3-bcrypt py3-cffi py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux
|
||||
apk --no-cache add ca-certificates curl bridge e2fsprogs-extra gettext iptables kbd-misc libcap libressl libseccomp postfix python3 py3-bcrypt py3-cffi py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux
|
||||
if [ ${DEBUG:-0} -eq 1 ]; then
|
||||
# Install some utilities for DEBUG mode
|
||||
apk --no-cache add git file htop less openssh-server openssh-sftp-server
|
||||
@ -63,8 +63,12 @@ vmmgr create-selfsigned
|
||||
# Configure nginx
|
||||
cp ${SOURCE_DIR}/etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Configure postfix
|
||||
cp ${SOURCE_DIR}/etc/postfix/main.cf /etc/postfix/main.cf
|
||||
newaliases
|
||||
|
||||
# Configure services
|
||||
for SERVICE in cgroups consolefont crond iptables nginx ntpd swap vmmgr; do
|
||||
for SERVICE in cgroups consolefont crond iptables nginx ntpd postfix swap vmmgr; do
|
||||
rc-update add ${SERVICE} boot
|
||||
service ${SERVICE} start
|
||||
done
|
||||
|
@ -1,8 +1,5 @@
|
||||
append_dot_mydomain = no
|
||||
biff = no
|
||||
compatibility_level = 2
|
||||
inet_protocols = ipv4
|
||||
mynetworks = 0.0.0.0/0
|
||||
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
||||
smtp_use_tls = yes
|
||||
smtputf8_enable = no
|
@ -1,21 +0,0 @@
|
||||
FROM alpine
|
||||
LABEL maintainer="Disassembler <disassembler@dasm.cz>"
|
||||
|
||||
RUN \
|
||||
# Create OS user (which will be picked up later by apk add)
|
||||
addgroup -S -g 587 postfix \
|
||||
&& adduser -S -u 587 -h /var/spool/postfix -s /bin/false -g postfix -G postfix postfix \
|
||||
# Install Postfix
|
||||
&& apk --no-cache add ca-certificates postfix \
|
||||
# Build aliases database
|
||||
&& newaliases \
|
||||
# Cleanup
|
||||
&& sed -ir '/^(#.*)?$/d' /etc/postfix/aliases \
|
||||
&& rm -r /etc/postfix/access /etc/postfix/canonical /etc/postfix/dynamicmaps.cf* /etc/postfix/generic /etc/postfix/header_checks /etc/postfix/postfix-files.d /etc/postfix/relocated /etc/postfix/transport /etc/postfix/virtual
|
||||
|
||||
COPY docker/ /
|
||||
|
||||
VOLUME ["/etc/postfix", "/var/spool/postfix"]
|
||||
EXPOSE 25
|
||||
|
||||
CMD ["s6-svscan", "/etc/services.d"]
|
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/postfix
|
||||
|
||||
# Build Docker container
|
||||
docker build -t postfix ${SOURCE_DIR}
|
||||
cp ${SOURCE_DIR}/etc/init.d/postfix /etc/init.d/postfix
|
||||
rc-update -u
|
||||
|
||||
# Copy existing config files into persistent storage
|
||||
mkdir -p /srv/postfix/conf /srv/postfix/data
|
||||
docker run --rm -v /srv/postfix/conf:/mnt/conf postfix cp -rp /etc/postfix/. /mnt/conf
|
||||
|
||||
# Configure postfix
|
||||
cp ${SOURCE_DIR}/srv/postfix/conf/main.cf /srv/postfix/conf/main.cf
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
/bin/true
|
@ -1,3 +0,0 @@
|
||||
#!/bin/execlineb -P
|
||||
|
||||
/usr/sbin/postfix -c /etc/postfix start-fg
|
@ -1,3 +0,0 @@
|
||||
#!/bin/execlineb -P
|
||||
|
||||
/sbin/syslogd -n -S -O -
|
@ -1,20 +0,0 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Postfix docker container"
|
||||
|
||||
depend() {
|
||||
need docker
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name postfix \
|
||||
-h postfix \
|
||||
-v /srv/postfix/conf:/etc/postfix \
|
||||
-v /srv/postfix/data:/var/spool/postfix \
|
||||
postfix
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop postfix
|
||||
}
|
Loading…
Reference in New Issue
Block a user