FROM php:8.1-apache
# Dockerfile Producao

# Instalar extensões PHP básicas
RUN apt-get update && apt-get install -y \
    libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
    libzip-dev libxml2-dev libonig-dev \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) gd \
    && docker-php-ext-install pdo pdo_mysql mysqli zip mbstring xml \
    && rm -rf /var/lib/apt/lists/*

# Configurações PHP para pedagogico_iemab
RUN echo 'display_errors = Off' > /usr/local/etc/php/conf.d/pedagogico.ini \
    && echo 'max_execution_time = 300' >> /usr/local/etc/php/conf.d/pedagogico.ini \
    && echo 'max_input_time = 300' >> /usr/local/etc/php/conf.d/pedagogico.ini \
    && echo 'max_input_vars = 3000' >> /usr/local/etc/php/conf.d/pedagogico.ini \
    && echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/pedagogico.ini \
    && echo 'post_max_size = 200M' >> /usr/local/etc/php/conf.d/pedagogico.ini \
    && echo 'session.gc_maxlifetime = 7200' >> /usr/local/etc/php/conf.d/pedagogico.ini \
    && echo 'upload_max_filesize = 100M' >> /usr/local/etc/php/conf.d/pedagogico.ini \
    && echo 'zlib.output_compression = Off' >> /usr/local/etc/php/conf.d/pedagogico.ini

# Habilitar mod_rewrite
RUN a2enmod rewrite

# Configurar permissões
RUN chown -R www-data:www-data /var/www/html

EXPOSE 80