From 11451f205c3f90fbde7777b67a211496ccf94c48 Mon Sep 17 00:00:00 2001 From: Torben Nehmer Date: Sun, 11 Nov 2018 20:34:41 +0100 Subject: [PATCH] Working Drupal 8 container including SSMTP. --- Dockerfile | 4 ++-- build-container.sh | 2 +- build-rootfs.sh | 19 ++++++++++++++----- src/mail.ini | 1 + src/ssmtp.conf | 16 ++++++++++++++++ 5 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 src/mail.ini create mode 100644 src/ssmtp.conf diff --git a/Dockerfile b/Dockerfile index 64144e0..fd502a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM docker:8 +FROM drupal:8 LABEL maintainer="Torben Nehmer " RUN set -ex; \ @@ -9,7 +9,7 @@ RUN set -ex; \ ; \ \ rm -rf /var/lib/apt/lists/* ;\ - apt-get clean ;\ + apt-get clean # Finally, publish the rootfs file into the container # This is done as last step to make docker build caching more efficient. diff --git a/build-container.sh b/build-container.sh index 6fd549e..392d6d5 100755 --- a/build-container.sh +++ b/build-container.sh @@ -2,4 +2,4 @@ set -ex -docker build --force-rm -t nathan/docker8 -f Dockerfile build +docker build --force-rm -t nathan/drupal8 -f Dockerfile build diff --git a/build-rootfs.sh b/build-rootfs.sh index f02f92d..95bcfac 100755 --- a/build-rootfs.sh +++ b/build-rootfs.sh @@ -3,7 +3,8 @@ set -ex # Configuration options you usually edit go here -# CONTAINER_WEBROOT=/var/www/html +CONTAINER_SSMTPCONFDIR=/etc/ssmtp +CONTAINER_PHP_CONFD=/usr/local/etc/php/conf.d # This is internal stuff used to build everything # Be aware, that several of these paths are used with rm -rf! @@ -13,7 +14,8 @@ BUILDDIR=$(pwd)/build SCRIPTS_SRC=${SRCDIR}/scripts ROOTFSTREE=${TMPDIR}/tree ROOTFSFILE=${BUILDDIR}/rootfs.tar.gz -# WEBROOT_DST=${ROOTFSTREE}${CONTAINER_WEBROOT} +SSMTPCONF_DST=${ROOTFSTREE}${CONTAINER_SSMTPCONFDIR} +PHP_CONFD_DST=${ROOTFSTREE}${CONTAINER_PHP_CONFD} #### Sanitize Build Enviornment if [ -d ${TMPDIR} ]; then @@ -27,9 +29,16 @@ fi mkdir ${BUILDDIR} #### Do the work. -# -# ... -# + +# Create SSMTP config file +mkdir -p ${SSMTPCONF_DST} +cp ${SRCDIR}/ssmtp.conf ${SSMTPCONF_DST}/ssmtp.conf + +# Setup PHP +mkdir -p ${PHP_CONFD_DST} +cp ${SRCDIR}/mail.ini ${PHP_CONFD_DST}/mail.ini + + # Clean up behind us # if [ "$CLEAN_INTERMEDIATES" = true ]; then # rm -rf ${ROUNDCUBE_SRC} diff --git a/src/mail.ini b/src/mail.ini new file mode 100644 index 0000000..a0c5ff4 --- /dev/null +++ b/src/mail.ini @@ -0,0 +1 @@ +sendmail_path = "/usr/sbin/ssmtp -t -i" diff --git a/src/ssmtp.conf b/src/ssmtp.conf new file mode 100644 index 0000000..5ef327b --- /dev/null +++ b/src/ssmtp.conf @@ -0,0 +1,16 @@ +# +# /etc/ssmtp.conf -- a config file for sSMTP sendmail. +# +# The person who gets all mail for userids < 1000 +# Make this empty to disable rewriting. +root=postmaster +# The place where the mail goes. The actual machine name is required +# no MX records are consulted. Commonly mailhosts are named mail.domain.com +# The example will fit if you are in domain.com and you mailhub is so named. +mailhub=nathan.nehmer.net +# Where will the mail seem to come from? +rewriteDomain=nehmer.net +# The full hostname +hostname=docker.nehmer.net + +UseSTARTTLS=Yes