FROM php:8.3-fpm # Install system dependencies RUN apt-get update && apt-get install -y \ git \ curl \ libpng-dev \ libonig-dev \ libxml2-dev \ libzip-dev \ libcurl4-openssl-dev \ zip \ unzip \ nginx \ supervisor # Clear cache RUN apt-get clean && rm -rf /var/lib/apt/lists/* # Install PHP extensions RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip dom curl # Get latest Composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Set working directory WORKDIR /var/www/html # Copy composer files COPY composer.json composer.lock ./ # Install PHP dependencies (without optimization) RUN composer install --no-dev --no-scripts # Copy application code COPY . . # Generate optimized autoloader now that source code is present RUN composer dump-autoload --optimize # Copy nginx configuration COPY nginx.conf /etc/nginx/sites-available/default # Copy supervisor configuration COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Create necessary directories RUN mkdir -p /var/log/supervisor # Expose port EXPOSE 80 # Start supervisor CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]