-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
83 lines (76 loc) · 2.71 KB
/
dockerfile
File metadata and controls
83 lines (76 loc) · 2.71 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# syntax=docker/dockerfile:1
FROM php:8.3-apache-bookworm
# =========================================================================
# ÉTAPE 1: Mises à jour de sécurité et Outils système
# =========================================================================
# - 'upgrade': Corrige les failles critiques (Apache, Libxml2...)
# - 'install': Ajoute les outils utilitaires (git, zip...)
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
git \
curl \
unzip \
zip \
# Nettoyage immédiat pour garder l'image légère
&& 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 \
gd \
zip \
pdo_mysql \
mysqli \
intl \
soap \
opcache \
exif \
ldap \
mbstring \
xsl \
bcmath \
sockets \
fileinfo \
xml \
gettext \
imagick \
apcu
# =========================================================================
# ÉTAPE 3: Configuration Apache
# =========================================================================
# Activation des modules requis
RUN a2enmod rewrite headers expires deflate
# Configuration du VirtualHost via Heredoc (Méthode 3 - Plus lisible)
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
file_uploads = On
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 80M
max_execution_time = 300
date.timezone = "UTC"
EOF
# =========================================================================
# ÉTAPE 5: Finition
# =========================================================================
WORKDIR /var/www/html
EXPOSE 80