45
This commit is contained in:
@@ -0,0 +1 @@
|
||||
# Déposer ici wildcard.beziers-mediterranee.fr.crt (chaîne complète) et .key — jamais dans git
|
||||
@@ -0,0 +1,70 @@
|
||||
# signature.beziers-mediterranee.fr — certificat wildcard *.beziers-mediterranee.fr
|
||||
server {
|
||||
listen 80;
|
||||
server_name signature.beziers-mediterranee.fr;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
server_name signature.beziers-mediterranee.fr;
|
||||
|
||||
ssl_certificate /etc/nginx/certs/wildcard.beziers-mediterranee.fr.crt;
|
||||
ssl_certificate_key /etc/nginx/certs/wildcard.beziers-mediterranee.fr.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
|
||||
server_tokens off;
|
||||
client_max_body_size 6m;
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
|
||||
root /var/www/html/public;
|
||||
index index.php;
|
||||
|
||||
# Add-in Outlook : chargé en iframe par Outlook, donc AUCUN X-Frame-Options ici.
|
||||
location /addin/ {
|
||||
alias /srv/addin/;
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Cache-Control "no-cache" always;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Logos et bannières : publics, mis en cache par les clients
|
||||
location /img/ {
|
||||
alias /var/www/html/public/img/;
|
||||
expires 7d;
|
||||
add_header Cache-Control "public" always;
|
||||
add_header Access-Control-Allow-Origin "*" always;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Back-office : filtrage réseau en plus du SSO et du contrôle applicatif
|
||||
location /admin {
|
||||
# Adapter aux réseaux internes CABM
|
||||
allow 10.0.0.0/8;
|
||||
allow 172.16.0.0/12;
|
||||
allow 192.168.0.0/16;
|
||||
deny all;
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location / {
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
fastcgi_hide_header X-Powered-By;
|
||||
}
|
||||
|
||||
location ~ /\.(?!well-known) { deny all; }
|
||||
}
|
||||
@@ -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"]
|
||||
@@ -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 "$@"
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user