FROM php:8.2-apache # Instalar extensiones RUN apt-get update && apt-get install -y \ libpng-dev \ libzip-dev \ unzip \ libonig-dev \ && docker-php-ext-install pdo_mysql mbstring zip gd # Habilitar mod_rewrite para que funcionen las rutas de Laravel RUN a2enmod rewrite # Establecer el directorio de trabajo WORKDIR /var/www/html # Copiar archivos COPY . . # IMPORTANTE: Cambiar el DocumentRoot de Apache a /public ENV APACHE_DOCUMENT_ROOT /var/www/html/public RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf # *** NUEVO: Forzar AllowOverride All para que .htaccess funcione *** # Esto reemplaza "AllowOverride None" por "AllowOverride All" en la config de Apache RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf # Permisos RUN chown -R www-data:www-data storage bootstrap/cache # Instalar Composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer