build upon the wordpress Docker image to add mail forwarding to the host using msmtp

This commit is contained in:
Adrien Luxey 2020-03-31 13:49:28 +02:00
parent d7548f937e
commit 47c4e39b73
4 changed files with 20 additions and 2 deletions

View File

@ -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?

10
wordpress/php/Dockerfile Normal file
View File

@ -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

1
wordpress/php/TODO Normal file
View File

@ -0,0 +1 @@
Add this to an Ansible role executing the templates to add the propoer IP, notably to msmtprc

7
wordpress/php/msmtprc.j2 Normal file
View File

@ -0,0 +1,7 @@
defaults
account default
host {{ host_ip }}
post 25