mirror of
https://github.com/plausible/hosting.git
synced 2025-07-03 18:47:29 -05:00
feat: Replace old bytemark/smtp image with the source code
This will allow more platforms to use this template repo. The original dockerhub image was last updated 5 years ago, and as such, newer architectures aren't supported like the Raspberry Pi 4 which a lot of people are using for self hosting these days
This commit is contained in:
13
smtp/stretch/Dockerfile
Normal file
13
smtp/stretch/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM debian:stretch-slim
|
||||
|
||||
# Install exim4
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN set -ex; \
|
||||
apt-get update; \
|
||||
apt-get install -y exim4-daemon-light; \
|
||||
apt-get clean
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
EXPOSE 25/tcp
|
||||
ENTRYPOINT [ "docker-entrypoint.sh" ]
|
||||
CMD [ "exim", "-bdf", "-v", "-q30m" ]
|
53
smtp/stretch/docker-entrypoint.sh
Executable file
53
smtp/stretch/docker-entrypoint.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
CONFDIR=/etc/exim4
|
||||
|
||||
# By default, send email directly to the recipient.
|
||||
DC_EXIMCONFIG_CONFIGTYPE="internet"
|
||||
|
||||
# By default, only hosts on the private network can use the smart host (ie,
|
||||
# only other containers, not the whole internet); a thin layer of protection
|
||||
# in case port 25 is accidentally exposed to the public internet.
|
||||
DC_RELAY_NETS="10.0.0.0/8;172.16.0.0/12;192.168.0.0/16"
|
||||
|
||||
# If RELAY_HOST has been set then switch to smart host configuration.
|
||||
if [ "x$RELAY_HOST" != "x" ]; then
|
||||
DC_EXIMCONFIG_CONFIGTYPE="satellite"
|
||||
DC_SMARTHOST="$RELAY_HOST::${RELAY_PORT:-25}"
|
||||
if [ "x$RELAY_USERNAME" != "x" ] && [ "x$RELAY_PASSWORD" != "x" ]; then
|
||||
printf '%s\n' "*:$RELAY_USERNAME:$RELAY_PASSWORD" > "$CONFDIR/passwd.client"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set which hosts can use the smart host.
|
||||
if [ "x$RELAY_NETS" != "x" ]; then
|
||||
DC_RELAY_NETS="$RELAY_NETS"
|
||||
fi
|
||||
|
||||
# Write exim configuration.
|
||||
cat << EOF > "$CONFDIR/update-exim4.conf.conf"
|
||||
dc_eximconfig_configtype='$DC_EXIMCONFIG_CONFIGTYPE'
|
||||
dc_other_hostnames=''
|
||||
dc_local_interfaces=''
|
||||
dc_readhost=''
|
||||
dc_relay_domains=''
|
||||
dc_minimaldns='false'
|
||||
dc_relay_nets='$DC_RELAY_NETS'
|
||||
dc_smarthost='${DC_SMARTHOST:-}'
|
||||
CFILEMODE='644'
|
||||
dc_use_split_config='false'
|
||||
dc_hide_mailname='true'
|
||||
dc_mailname_in_oh='true'
|
||||
dc_localdelivery='mail_spool'
|
||||
EOF
|
||||
|
||||
# Set primary_hostname.
|
||||
if [ "x$MAILNAME" != "x" ]; then
|
||||
printf '%s\n' "$MAILNAME" > /etc/mailname
|
||||
printf '%s\n' "MAIN_HARDCODE_PRIMARY_HOSTNAME=$MAILNAME" >> "$CONFDIR/update-exim4.conf.conf"
|
||||
fi
|
||||
|
||||
# Apply exim configuration.
|
||||
update-exim4.conf
|
||||
|
||||
exec "$@"
|
Reference in New Issue
Block a user