# Exemple d'image pour Lutin Mystère.
# Construction depuis la racine du projet :  docker build -f docker/Dockerfile -t lutin-mystere .
FROM php:8.2-apache

# mysqli (base de données) et GD avec FreeType/JPEG/PNG (lettre personnalisée). mbstring est déjà inclus.
RUN apt-get update \
 && apt-get install -y --no-install-recommends libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
 && docker-php-ext-configure gd --with-freetype --with-jpeg \
 && docker-php-ext-install -j"$(nproc)" gd mysqli \
 && a2enmod headers \
 && sed -ri 's!AllowOverride None!AllowOverride All!' /etc/apache2/apache2.conf \
 && rm -rf /var/lib/apt/lists/*

COPY . /var/www/html/

# La configuration (accès base, mot de passe admin) vit sur un volume : elle survit à la recréation du conteneur.
RUN mkdir -p /config && chown www-data:www-data /config
ENV LUTIN_CONFIG=/config/config.local.php
VOLUME /config
