FROM php:8.4-fpm

RUN apt-get update && apt-get install -y --no-install-recommends \
    libpq-dev \
    libsqlite3-dev \
    libzip-dev \
    libxml2-dev \
    libicu-dev \
    libpng-dev \
    libjpeg-dev \
    libfreetype-dev \
    libmagickwand-dev \
    unzip \
    && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install \
    pdo_mysql \
    pdo_pgsql \
    pdo_sqlite \
    zip \
    intl \
    gd \
    && pecl install redis imagick pcov \
    && docker-php-ext-enable redis imagick pcov \
    && groupadd -g 1000 appuser && useradd -u 1000 -g appuser -m appuser

WORKDIR /app

USER appuser
