-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile.template
More file actions
67 lines (59 loc) · 3.03 KB
/
dockerfile.template
File metadata and controls
67 lines (59 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# syntax=docker/dockerfile:1
FROM php:%%PHP_VERSION%%-apache-bookworm
# =========================================================================
# Métadonnées de l'image
# =========================================================================
LABEL org.opencontainers.image.title="PHP Apache Multi-Arch" \
org.opencontainers.image.description="Image PHP 8.3 + Apache multi-architecture (AMD64/ARM64) avec extensions CMS (WordPress, Nextcloud, Joomla) et sécurité renforcée" \
org.opencontainers.image.vendor="Mouette03" \
org.opencontainers.image.licenses="GPL-3.0" \
org.opencontainers.image.source="https://github.com/Mouette03/WebApp"
# =========================================================================
# ÉTAPE 1: Mises à jour de sécurité et Outils système
# =========================================================================
# - 'upgrade': Corrige les failles critiques (Apache, Libxml2...)
# - 'install': Ajoute les outils utilitaires
# Nettoyage (apt-get clean) pour réduire la taille de l'image.
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
%%SYSTEM_TOOLS%% \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# =========================================================================
# ÉTAPE 2: Installation Robuste des Extensions PHP (Core + PECL)
# =========================================================================
# Utilisation du script officiel mlocati pour gérer la compatibilité ARM64/AMD64
# Cela remplace 'docker-php-ext-install' et 'pecl install' qui plantaient sur ARM
COPY --from=mlocati/php-extension-installer:latest /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions \
%%PHP_EXTENSIONS%%
# =========================================================================
# ÉTAPE 3: Configuration Apache
# =========================================================================
# Activation de SSLStrictSNIVHostCheck recommandée pour mitiger CVE-2025-23048 si SSL est utilisé
RUN a2enmod rewrite headers expires deflate
# Configuration du VirtualHost via Heredoc (plus lisible que echo)
COPY <<EOF /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
# =========================================================================
# ÉTAPE 4: Configuration PHP Personnalisée
# =========================================================================
# Création du fichier de configuration prioritaire via Heredoc
COPY <<EOF /usr/local/etc/php/conf.d/zz-custom-settings.ini
%%PHP_INI_SETTINGS%%
EOF
# =========================================================================
# ÉTAPE 5: Finition
# =========================================================================
WORKDIR /var/www/html
EXPOSE 80