FROM php:8.3-fpm

# Install system dependencies
RUN apt-get update && apt-get install -y \
    supervisor \
    libzip-dev \
    unzip \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo pdo_mysql bcmath zip

# Install Redis extension
RUN pecl install redis && docker-php-ext-enable redis

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Copy supervisor configuration
COPY supervisord.conf /etc/supervisor/supervisord.conf

# Create log directory
RUN mkdir -p /var/log/supervisor

CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]