Files
immorechner/Dockerfile
2025-11-09 10:15:40 +01:00

60 lines
1.2 KiB
Docker

# Production-ready Symfony Dockerfile
FROM php:8.4-apache
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev \
libonig-dev \
libxml2-dev \
libicu-dev \
libzip-dev \
git \
curl \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install PHP extensions needed by Symfony
RUN docker-php-ext-configure intl \
&& docker-php-ext-install -j$(nproc) \
pdo_mysql \
mbstring \
exif \
pcntl \
bcmath \
gd \
zip \
intl \
opcache
# Enable Apache modules
RUN a2enmod rewrite headers
# Copy Apache configuration
COPY ./docker/apache/000-default.conf /etc/apache2/sites-available/000-default.conf
# Copy Composer from official image
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Copy Symfony app
COPY . /var/www/html
# Optimize permissions
RUN chown -R www-data:www-data /var/www/html
# Configure opcache for production
RUN { \
echo "opcache.enable=1"; \
echo "opcache.memory_consumption=256"; \
echo "opcache.max_accelerated_files=20000"; \
echo "opcache.validate_timestamps=0"; \
} > /usr/local/etc/php/conf.d/opcache.ini
# Expose port 80
EXPOSE 80
# Start Apache
CMD ["apache2-foreground"]