FROM php:8.3-apache # Set Environment Variables ENV DEBIAN_FRONTEND=noninteractive ENV COMPOSER_ALLOW_SUPERUSER=1 ENV APP_ENV=production # Install system dependencies RUN set -eux; \ apt-get update; \ apt-get upgrade -y; \ apt-get install -y --no-install-recommends \ curl \ ffmpeg \ libmemcached-dev \ libz-dev \ libpq-dev \ libjpeg-dev \ libpng-dev \ libfreetype6-dev \ libssl-dev \ libwebp-dev \ libxpm-dev \ libmcrypt-dev \ libonig-dev \ netcat-traditional \ git \ curl \ zip \ zlib1g-dev \ libicu-dev \ g++ \ unzip; \ rm -rf /var/lib/apt/lists/* # Install PHP extensions RUN set -eux; \ docker-php-ext-install pdo_mysql; \ docker-php-ext-install pdo_pgsql; \ docker-php-ext-configure gd \ --prefix=/usr \ --with-jpeg \ --with-webp \ --with-xpm \ --with-freetype; \ docker-php-ext-install exif; \ docker-php-ext-install gd; \ docker-php-ext-install bcmath; \ docker-php-ext-configure intl; \ docker-php-ext-install intl; \ docker-php-ext-install pcntl; \ docker-php-ext-configure pcntl --enable-pcntl # Enable Apache modules RUN a2enmod rewrite headers # Get latest Composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Set working directory WORKDIR /var/www/html # Copy composer files first for layer caching COPY composer.json composer.lock ./ # Install dependencies RUN composer install --optimize-autoloader --no-scripts --ignore-platform-req=ext-zip --no-dev # Copy application COPY . . # Create directories and set permissions RUN mkdir -p storage/framework/sessions storage/framework/views storage/framework/cache bootstrap/cache && \ chown -R www-data:www-data storage bootstrap/cache && \ chmod -R 775 storage bootstrap/cache # Apache configuration COPY docker/apache/000-default.conf /etc/apache2/sites-available/000-default.conf # Expose port EXPOSE 80 CMD ["apache2-foreground"]