web / Dockerfile
l-g-t's picture
Update Dockerfile
96af26a verified
raw
history blame contribute delete
818 Bytes
FROM php:8.2-apache
# 设置 Apache 监听 Hugging Face 要求的端口 7860
RUN sed -i 's/80/7860/g' /etc/apache2/ports.conf /etc/apache2/sites-enabled/000-default.conf
# 设置 ServerName,避免警告
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
# 安装 PHP 常用扩展(如 fileinfo、mbstring、gd 等)
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libzip-dev \
libonig-dev \
&& docker-php-ext-install -j$(nproc) gd mbstring zip
# 启用 Apache 的必要模块
RUN a2enmod rewrite headers
# 拷贝 PHP 文件
COPY ./public-html/ /var/www/html/
# 设置工作目录
WORKDIR /var/www/html
# 设置合适的权限(可选)
RUN chown -R www-data:www-data /var/www/html
EXPOSE 7860
CMD ["apache2-foreground"]