FROM docker.io/library/php:8.3-cli

ENV DEBIAN_FRONTEND=noninteractive

# Install system dependencies and PHP extensions needed by the app
RUN set -eux; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        git \
        unzip \
        libzip-dev \
        libpng-dev \
        libjpeg62-turbo-dev \
        libfreetype6-dev \
        libicu-dev \
        libonig-dev \
        libsqlite3-dev \
        pkg-config; \
    docker-php-ext-configure gd --with-freetype --with-jpeg; \
    docker-php-ext-install -j"$(nproc)" \
        bcmath \
        intl \
        gd \
        pdo \
        pdo_mysql \
        pdo_sqlite \
        zip; \
    apt-get clean; \
    rm -rf /var/lib/apt/lists/*

# Provide Composer for dependency management
COPY --from=docker.io/library/composer:2 /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

CMD ["php", "-v"]
