From 47c4e39b738014a95f932218d45c6ea85608d52d Mon Sep 17 00:00:00 2001 From: Adrien Luxey Date: Tue, 31 Mar 2020 13:49:28 +0200 Subject: [PATCH] build upon the wordpress Docker image to add mail forwarding to the host using msmtp --- README.md | 4 ++-- wordpress/php/Dockerfile | 10 ++++++++++ wordpress/php/TODO | 1 + wordpress/php/msmtprc.j2 | 7 +++++++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 wordpress/php/Dockerfile create mode 100644 wordpress/php/TODO create mode 100644 wordpress/php/msmtprc.j2 diff --git a/README.md b/README.md index 9a3441d..abbfd1b 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ * [Dockerise your PHP app with PHP-FPM and nginx](http://geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/) -nginx and PHP-FPM both need access to the files--at the same location. It's thus not easy to have a single nginx serving multiple PHP-FPM containers. You always need a webserver in the same container as PHP-FPM. +nginx and PHP-FPM both need access to the files--at the same location. It's thus not easy to have a single nginx serving multiple PHP-FPM containers. You always need a webserver in the same container as PHP-FPM. ### Alternatives -* [WP multisite + Caddy](https://skippy.net/caddy-docker-php-wordpress): arguments against using the Wordpress Docker image, keeps the whole wp install outside the image, and instead focuses on properly configuring PHP-FPM. Has the advantage of being reusable for other PHP projects. Is well argumented. +* [WP multisite + Caddy](https://skippy.net/caddy-docker-php-wordpress): arguments against using the Wordpress Docker image, keeps the whole wp install outside the image, and instead focuses on properly configuring PHP-FPM. Has the advantage of being reusable for other PHP projects. Is well argumented. Tackles file access rights and mailing (ssmtp), it's a good source! #### Which webserver? diff --git a/wordpress/php/Dockerfile b/wordpress/php/Dockerfile new file mode 100644 index 0000000..061ebd0 --- /dev/null +++ b/wordpress/php/Dockerfile @@ -0,0 +1,10 @@ +FROM wordpress:apache + +RUN apt-get update; \ + apt-get install -y --no-install-recommends msmtp; \ + rm -rf /var/lib/apt/lists/* + +RUN echo "sendmail_path = /usr/sbin/msmtp -t " > /usr/local/etc/php/conf.d/sendmail.ini + +COPY ./msmtprc /etc/msmtprc + diff --git a/wordpress/php/TODO b/wordpress/php/TODO new file mode 100644 index 0000000..def7654 --- /dev/null +++ b/wordpress/php/TODO @@ -0,0 +1 @@ +Add this to an Ansible role executing the templates to add the propoer IP, notably to msmtprc diff --git a/wordpress/php/msmtprc.j2 b/wordpress/php/msmtprc.j2 new file mode 100644 index 0000000..d930c1b --- /dev/null +++ b/wordpress/php/msmtprc.j2 @@ -0,0 +1,7 @@ +defaults + +account default +host {{ host_ip }} +post 25 + +