diff --git a/Dockerfile b/Dockerfile index c4c9111..7af5cc7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,7 +78,7 @@ RUN set -x ; \ DEBIAN_FRONTEND="noninteractive" apt-get -y update && \ DEBIAN_FRONTEND="noninteractive" apt-get -y upgrade && \ DEBIAN_FRONTEND="noninteractive" apt-get -y install \ - wget ca-certificates gnupg \ + wget ca-certificates gnupg iproute2 \ $( cat /tmp/derived-deps ) \ libclass-c3-xs-perl \ texlive-plain-generic texlive-latex-recommended texlive-fonts-recommended \ @@ -110,7 +110,9 @@ WORKDIR /srv/ledgersmb # Configure outgoing mail to use host, other run time variable defaults ## MAIL -ENV LSMB_MAIL_SMTPHOST 172.17.0.1 +# '__CONTAINER_GATEWAY__' is a magic value which will be substituted +# with the actual gateway IP address +ENV LSMB_MAIL_SMTPHOST __CONTAINER_GATEWAY__ #ENV LSMB_MAIL_SMTPPORT 25 #ENV LSMB_MAIL_SMTPSENDER_HOSTNAME (container hostname) #ENV LSMB_MAIL_SMTPTLS diff --git a/start.sh b/start.sh index 2f193c1..d1fecdc 100755 --- a/start.sh +++ b/start.sh @@ -67,7 +67,6 @@ if [[ -n "$LSMB_HAVE_DEPRECATED" ]]; then echo "!!! DEPRECATED \$SSMTP_* PARAMETERS WILL BE REMOVED in the 1.9 image!!!" fi - if [[ ! -f ./local/conf/ledgersmb.yaml ]]; then cat <./local/conf/ledgersmb.yaml paths: @@ -105,6 +104,12 @@ EOF if [[ -n "$LSMB_MAIL_SMTPHOST" ]] then + if [[ "$LSMB_MAIL_SMTPHOST" == "__CONTAINER_GATEWAY__" ]] + then + LSMB_MAIL_SMTPHOST="$(ip route | awk '/default/ { print $3 }')" + export LSMB_MAIL_SMTPHOST + fi + cat <./local/conf/ledgersmb.000.yaml mail: transport: