FROM php:8.2-apache-bookworm

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
    libcurl4-openssl-dev \
    libonig-dev \
    ca-certificates \
    && docker-php-ext-install curl mbstring mysqli pdo pdo_mysql \
    && a2enmod rewrite \
    && echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf \
    && a2enconf servername \
    && rm -rf /var/lib/apt/lists/*

COPY . /var/www/html/

RUN mkdir -p /var/www/html/api/cache \
    && chown -R www-data:www-data /var/www/html \
    && chmod -R 775 /var/www/html/api/cache

EXPOSE 80
