# 使用 PHP 8.2 with Apache FROM php:8.2-apache # 安装必要的 PHP 扩展 RUN docker-php-ext-install pdo pdo_mysql # 启用 Apache mod_rewrite 和 mod_headers RUN a2enmod rewrite headers # 复制项目文件到容器 COPY . /var/www/html/ # 设置工作目录 WORKDIR /var/www/html # 设置正确的权限 RUN chown -R www-data:www-data /var/www/html \ && chmod -R 755 /var/www/html # 创建 Apache 配置 RUN echo '\n\ Options Indexes FollowSymLinks\n\ AllowOverride All\n\ Require all granted\n\ ' > /etc/apache2/conf-available/live2d.conf \ && a2enconf live2d # 暴露端口 EXPOSE 80 # 启动 Apache CMD ["apache2-foreground"]