This commit is contained in:
mrKamoo
2026-09-30 16:27:32 +02:00
commit 310724708f
147 changed files with 21327 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
# Image applicative : PHP-FPM 8.4 + code Laravel + add-in compilé.
# Build depuis la racine du dépôt (deploy/deploy.sh s'en charge).
FROM node:22-bookworm-slim AS addin
WORKDIR /build
COPY addin/package*.json ./
RUN npm ci
COPY addin/ ./
# addin/.env (valeurs de production) est lu par webpack au build
RUN npm run build
FROM composer:2 AS vendor
WORKDIR /app
COPY backend/composer.json backend/composer.lock ./
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --no-interaction --ignore-platform-req=ext-intl
COPY backend/ ./
RUN composer dump-autoload --optimize --no-dev --no-scripts
FROM php:8.4-fpm-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends libicu-dev libzip-dev unzip \
&& docker-php-ext-install pdo_mysql intl zip opcache \
&& rm -rf /var/lib/apt/lists/*
COPY docker/php/php.ini /usr/local/etc/php/conf.d/zz-signature.ini
WORKDIR /var/www/html
COPY --from=vendor --chown=www-data:www-data /app ./
# Découverte des paquets (Socialite, providers…) : ignorée plus haut avec --no-scripts
RUN php artisan package:discover --ansi && chown -R www-data:www-data bootstrap/cache storage
# Fichiers statiques de l'add-in, publiés par l'entrypoint dans le volume lu par Nginx
COPY --from=addin /build/dist /opt/addin-dist
COPY docker/php/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
CMD ["php-fpm"]
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
# Initialisation au démarrage du service principal uniquement (php-fpm).
# Une commande ponctuelle (docker compose run app php artisan …) est exécutée directement.
cd /var/www/html || exit 1
if [ "$1" = "php-fpm" ]; then
# Publie l'add-in compilé dans le volume partagé avec Nginx
if [ -d /srv/addin ]; then
rm -rf /srv/addin/* && cp -r /opt/addin-dist/. /srv/addin/
fi
# Un échec de migration ne doit pas faire boucler le conteneur : on journalise et on démarre.
php artisan migrate --force || echo "[entrypoint] ATTENTION : migrations en échec, voir les logs ci-dessus" >&2
php artisan config:cache || true
php artisan route:cache || true
php artisan view:cache || true
# Les commandes ci-dessus tournent en root : on rend storage et le cache à www-data
chown -R www-data:www-data storage bootstrap/cache
fi
exec "$@"
+8
View File
@@ -0,0 +1,8 @@
expose_php = Off
memory_limit = 256M
upload_max_filesize = 5M
post_max_size = 6M
date.timezone = Europe/Paris
opcache.enable = 1
opcache.validate_timestamps = 0
opcache.memory_consumption = 128