FROM php:8.1-apache

RUN apt-get update && apt-get install -y \
    libpng-dev libjpeg-dev libzip-dev unzip \
    && docker-php-ext-install pdo pdo_mysql gd zip \
    && a2enmod rewrite

COPY . /var/www/html/

RUN echo '<Directory /var/www/html>\n\
    AllowOverride All\n\
    Require all granted\n\
</Directory>' >> /etc/apache2/apache2.conf

RUN mkdir -p /var/www/html/public/images/uploads \
             /var/www/html/public/images/laporan \
             /var/www/html/public/images/warga \
             /var/www/html/public/images/bantuan \
    && chown -R www-data:www-data /var/www/html/public \
    && chmod -R 775 /var/www/html/public/images

EXPOSE 80