-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (30 loc) · 893 Bytes
/
Dockerfile
File metadata and controls
36 lines (30 loc) · 893 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
30
31
32
33
34
35
36
# 1. Image de base PHP + Apache
FROM php:8.2-apache
# 2. Installation des extensions nécessaires + activation de rewrite
RUN apt-get update \
&& apt-get install -y \
git \
unzip \
libzip-dev \
libpq-dev \
&& docker-php-ext-install \
zip \
pdo_pgsql \
pgsql \
&& a2enmod rewrite \
&& rm -rf /var/lib/apt/lists/*
# 3. On dit à Apache de servir /public
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri \
-e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' \
/etc/apache2/sites-available/*.conf
# 4. Copier tout le projet dans l’image
WORKDIR /var/www/html
COPY . .
# 5. Installer Composer et les dépendances
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
# 6. Exposer le bon port
EXPOSE 80
# 7. Lancer Apache en foreground
CMD ["apache2-foreground"]