FROM php:8.4-fpm-alpine # Install system dependencies RUN apk add --no-cache \ git \ curl \ libpng-dev \ oniguruma-dev \ libxml2-dev \ zip \ unzip \ nginx \ supervisor \ imap-dev \ krb5-dev \ linux-headers \ nodejs \ npm \ bash \ icu-dev \ $PHPIZE_DEPS # 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 \ && apk del $PHPIZE_DEPS # 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/Node dependencies and build frontend RUN composer install --no-interaction --no-dev --optimize-autoloader \ && npm install \ && npm run build \ && npm cache clean --force # Nginx config # Alpine uses http.d instead of sites-available COPY .docker/nginx.conf /etc/nginx/http.d/default.conf # Supervisor config RUN mkdir -p /etc/supervisor/conf.d /var/log/supervisor COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Set directory permissions RUN mkdir -p /run/nginx /var/lib/nginx \ && chown -R www-data:www-data /var/www \ && chown -R www-data:www-data /var/lib/nginx \ && chown -R www-data:www-data /run/nginx \ && chmod -R 775 /var/www/storage /var/www/bootstrap/cache 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"]