FROM php:8.2-apache

# Enable mod_rewrite for clean URLs and .htaccess support
RUN a2enmod rewrite

# Install PHP extensions needed: mysqli (sig-03), pdo + pdo_mysql (sig-01, sig-02)
RUN docker-php-ext-install mysqli pdo pdo_mysql

# Allow .htaccess overrides in /var/www/html
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf

# Copy all project files into Apache web root
COPY . /var/www/html/

# Fix file permissions
RUN chown -R www-data:www-data /var/www/html \
    && chmod -R 755 /var/www/html
