Configuration du Dockerfile et support de l'envoi de mails

This commit is contained in:
galaxyoyo 2019-09-08 23:10:59 +02:00
parent 722fad4e6f
commit fbabdff69c
4 changed files with 52 additions and 5 deletions

View File

@ -1,8 +1,37 @@
FROM php:7.3-apache as plateforme-builder
# Enabling apache rewrite mod
RUN a2enmod rewrite
RUN apt clean && apt update && apt upgrade -y
# Install MySQL drivers
RUN docker-php-ext-install pdo_mysql \
&& docker-php-ext-enable pdo_mysql
COPY . /var/www/html/
# Install zip utilities
RUN apt install -y libzip-dev zip \
&& docker-php-ext-configure zip --with-libzip \
&& docker-php-ext-install zip \
&& docker-php-ext-enable zip
# Setup locales
RUN apt install locales locales-all -y && locale-gen fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR:fr
ENV LC_ALL fr_FR.UTF-8
# Setup timezone
RUN echo Europe/Paris > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata
# Setup mailing
RUN apt install -yq msmtp ca-certificates
COPY setup/msmtprc /etc/msmtprc
RUN echo "sendmail_path=msmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini
# Setting environment
ENV TFJM_LOCAL_PATH /var/www/html
ENV TFJM_MAIL_DOMAIN tfjm.org
ENV TFJM_URL_BASE https://inscription.tfjm.org

View File

@ -9,8 +9,8 @@ class Mailer
$content = preg_replace("#{URL_BASE}#", $URL_BASE, $content);
$content = preg_replace("#{YEAR}#", $YEAR, $content);
$headers = "From: " . $from . "@" . $MAIL_DOMAIN . "\r\n";
$headers .= "Reply-To: contact@" . $MAIL_DOMAIN . "\r\n";
$headers = "From: \"Contact TFJM²\" <" . $from . "@" . $MAIL_DOMAIN . ">\r\n";
$headers .= "Reply-To: \"Contact TFJM²\" <contact@" . $MAIL_DOMAIN . ">\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
mail($email, $subject, $content, $headers);

View File

@ -19,8 +19,8 @@ SET time_zone = "+02:00";
--
-- Base de données : `tfjm`
--
CREATE DATABASE IF NOT EXISTS `tfjm` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `tfjm`;
CREATE DATABASE IF NOT EXISTS `inscription-tfjm` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `inscription-tfjm`;
-- --------------------------------------------------------

18
setup/msmtprc Normal file
View File

@ -0,0 +1,18 @@
defaults
auth on
tls on
tls_starttls off
tls_trust_file /etc/ssl/certs/ca-certificates.crt
syslog on
logfile /var/log/msmtp.log
account tfjm
host ssl0.ovh.net
auth on
port 465
from contact@tfjm.org
user contact@tfjm.org
passwordeval "echo $TFJM_MAIL_PASSWORD"
# Set a default account
account default : tfjm