FROM php:8.2-fpm-alpine

RUN apk add --no-cache \
    linux-headers \
    $PHPIZE_DEPS \
    icu-dev \
    libzip-dev \
    oniguruma-dev \
    postgresql-dev \
    mysql-client \
    redis \
    supervisor \
    nginx \
    curl \
    git \
    unzip \
    nodejs \
    npm

RUN docker-php-ext-configure intl && \
    docker-php-ext-install -j$(nproc) \
    intl \
    pdo_mysql \
    zip \
    bcmath \
    opcache \
    pcntl \
    sockets

RUN pecl install redis && docker-php-ext-enable redis

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

COPY docker/php/php.ini /usr/local/etc/php/php.ini
COPY docker/php/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

EXPOSE 9000

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