FROM php:8.2-apache

# Install necessary PHP extensions for MySQL and Image handling
RUN apt-get update && apt-get install -y \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) gd pdo_mysql

# Enable Apache mod_rewrite (useful for many PHP apps)
RUN a2enmod rewrite

# Copy your source code into the container
COPY . /var/www/html/

# Set permissions
RUN chown -R www-data:www-data /var/www/html
