mcServerWebsite/docker/apache/Dockerfile
Ploush a746069e4f
All checks were successful
Build & Deploy / Validation, build et push (push) Successful in 10m53s
Fix invalid php extension in php8.5
2026-07-07 16:22:20 +02:00

62 lines
2.8 KiB
Docker

# ============================================================
# Image Apache + PHP pour Symfony
# Le code source est copié dans l'image au moment du build
# ============================================================
FROM php:8.5-apache
# ── Dépendances système ──────────────────────────────────────
RUN apt-get update && apt-get install -y \
libicu-dev \
libzip-dev \
libpq-dev \
unzip \
git \
&& docker-php-ext-install \
intl \
pdo \
pdo_pgsql \
zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# ── Modules Apache ───────────────────────────────────────────
RUN a2enmod rewrite headers
# ── Composer ────────────────────────────────────────────────
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# ── Code source Symfony ──────────────────────────────────────
WORKDIR /var/www/html
# On copie d'abord composer.json pour profiter du cache Docker
COPY app/composer.json app/composer.lock ./
RUN composer install --no-dev --optimize-autoloader --no-scripts --no-interaction
# Puis le reste du code
COPY app/ .
# ── Assets ──────────────────────────────────────────────
RUN APP_ENV=prod php bin/console importmap:install
RUN APP_ENV=prod php bin/console asset-map:compile
# ── Droits ──────────────────────────────────────────────────
RUN mkdir -p /var/www/html/var \
&& chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html/var
# ── Config PHP ───────────────────────────────────────────
COPY docker/apache/php.ini /usr/local/etc/php/conf.d/custom.ini
COPY docker/apache/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
# ── Config Apache ────────────────────────────────────────────
COPY docker/apache/symfony.conf /etc/apache2/sites-enabled/000-default.conf
# ── Gestion Droits Volume ────────────────────────────────────────────
COPY docker/apache/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["apache2-foreground"]
EXPOSE 80