FROM php:8.2-fpm

# Fix Debian Buster repository (EOL)
RUN sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list \
 && sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list

# Install system packages
RUN apt update && apt install -y \
    git \
    zip \
    unzip \
    libzip-dev \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    curl

# Install PHP extensions
RUN docker-php-ext-configure gd \
    --with-freetype-dir=/usr/include/ \
    --with-jpeg-dir=/usr/include/

RUN docker-php-ext-install \
    pdo \
    pdo_mysql \
    mbstring \
    bcmath \
    zip \
    gd

# Install Composer v1 (required for Laravel 5.5)
RUN curl -sS https://getcomposer.org/installer | php -- --version=1.10.26 \
 && mv composer.phar /usr/local/bin/composer

WORKDIR /var/www