FROM php:8.4-fpm # Install system dependencies RUN apt-get update && apt-get install -y \ git \ curl \ libpng-dev \ libonig-dev \ libxml2-dev \ zip \ unzip \ nginx \ supervisor \ libc-client-dev \ libkrb5-dev \ && rm -rf /var/lib/apt/lists/* # Configure and install PHP extensions RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ && docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd intl imap \ && pecl install redis \ && docker-php-ext-enable redis # Install Composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Set working directory WORKDIR /var/www # Copy existing application directory contents COPY . /var/www # Install PHP dependencies RUN composer install --no-interaction --no-dev --optimize-autoloader # Nginx config COPY .docker/nginx.conf /etc/nginx/sites-available/default RUN rm -rf /etc/nginx/sites-enabled/default && ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default # Supervisor config COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Set directory permissions RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache \ && chmod -R 775 /var/www/storage /var/www/bootstrap/cache # Build frontend assets RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs \ && npm install \ && npm run build \ && apt-get remove -y nodejs \ && apt-get autoremove -y EXPOSE 80 # Configure entrypoint COPY .docker/entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh # Start Supervisor CMD ["/usr/local/bin/entrypoint.sh"]