-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (21 loc) · 888 Bytes
/
Dockerfile
File metadata and controls
29 lines (21 loc) · 888 Bytes
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
# Utiliser l'image PHP 8.1 avec Apache
FROM php:8.1-apache
# Installer les extensions nécessaires et Composer
RUN apt-get update && apt-get install -y \
unzip curl git libzip-dev \
&& docker-php-ext-install pdo pdo_mysql zip \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Activer les modules Apache
RUN a2enmod rewrite
# Définir le répertoire de travail
WORKDIR /var/www/html
# Copier les fichiers du projet dans le conteneur
COPY . /var/www/html
# Définition des permissions pour éviter les erreurs 403 et 500
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
# Installer les dépendances PHP avec Composer
RUN composer install --no-dev --prefer-dist --optimize-autoloader
# Donner les bons droits aux fichiers
RUN chown -R www-data:www-data /var/www/html
EXPOSE 80