# Use the official PHP 7.4 with Apache
FROM php:7.4.33-apache

# Install necessary PHP extensions
RUN apt-get update && apt-get install -y \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    zip \
    unzip \
    && docker-php-ext-configure gd \
    && docker-php-ext-install gd pdo pdo_mysql mysqli

# Enable Apache mod_rewrite
RUN a2enmod rewrite

# Set working directory
WORKDIR /var/www/html

# Copy application files
COPY . /var/www/html

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

# Copy Apache config
COPY Docker/apache.conf /etc/apache2/sites-available/000-default.conf

# Expose ports
EXPOSE 80

# Start services
CMD ["apache2-foreground"]
