Update Dockerfile
Browse files- Dockerfile +17 -5
Dockerfile
CHANGED
|
@@ -3,17 +3,29 @@ FROM php:8.2-apache
|
|
| 3 |
# 设置 Apache 监听 Hugging Face 要求的端口 7860
|
| 4 |
RUN sed -i 's/80/7860/g' /etc/apache2/ports.conf /etc/apache2/sites-enabled/000-default.conf
|
| 5 |
|
| 6 |
-
RUN sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
| 7 |
-
|
| 8 |
# 设置 ServerName,避免警告
|
| 9 |
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# 拷贝 PHP 文件
|
| 12 |
COPY ./public-html/ /var/www/html/
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
EXPOSE 7860
|
| 19 |
|
|
|
|
| 3 |
# 设置 Apache 监听 Hugging Face 要求的端口 7860
|
| 4 |
RUN sed -i 's/80/7860/g' /etc/apache2/ports.conf /etc/apache2/sites-enabled/000-default.conf
|
| 5 |
|
|
|
|
|
|
|
| 6 |
# 设置 ServerName,避免警告
|
| 7 |
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
| 8 |
|
| 9 |
+
# 安装 PHP 常用扩展(如 fileinfo、mbstring、gd 等)
|
| 10 |
+
RUN apt-get update && apt-get install -y \
|
| 11 |
+
libfreetype6-dev \
|
| 12 |
+
libjpeg62-turbo-dev \
|
| 13 |
+
libpng-dev \
|
| 14 |
+
libzip-dev \
|
| 15 |
+
libonig-dev \
|
| 16 |
+
&& docker-php-ext-install -j$(nproc) gd mbstring zip
|
| 17 |
+
|
| 18 |
+
# 启用 Apache 的必要模块
|
| 19 |
+
RUN a2enmod rewrite headers
|
| 20 |
+
|
| 21 |
# 拷贝 PHP 文件
|
| 22 |
COPY ./public-html/ /var/www/html/
|
| 23 |
|
| 24 |
+
# 设置工作目录
|
| 25 |
+
WORKDIR /var/www/html
|
| 26 |
+
|
| 27 |
+
# 设置合适的权限(可选)
|
| 28 |
+
RUN chown -R www-data:www-data /var/www/html
|
| 29 |
|
| 30 |
EXPOSE 7860
|
| 31 |
|