Update Dockerfile
Browse files- Dockerfile +17 -52
Dockerfile
CHANGED
|
@@ -1,54 +1,19 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
server_name _;
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
proxy_set_header Host $host;
|
| 11 |
-
proxy_set_header X-Real-IP $remote_addr;
|
| 12 |
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 13 |
-
proxy_set_header X-Forwarded-Proto $scheme;
|
| 14 |
-
|
| 15 |
-
# 如果遇到 SSL 问题,可以尝试取消下面这行的注释
|
| 16 |
-
# proxy_ssl_verify off;
|
| 17 |
-
|
| 18 |
-
# 如果遇到超时问题,可以增加超时时间
|
| 19 |
-
proxy_connect_timeout 60s;
|
| 20 |
-
proxy_read_timeout 60s;
|
| 21 |
-
|
| 22 |
-
# 增加缓冲区大小
|
| 23 |
-
proxy_buffers 16 16k;
|
| 24 |
-
proxy_buffer_size 32k;
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
# 处理 /cw/ 路径的请求
|
| 28 |
-
location /cw/ {
|
| 29 |
-
rewrite ^/cw/(.*)$ /$1 break;
|
| 30 |
-
proxy_pass https://cc.cwapi.me;
|
| 31 |
-
|
| 32 |
-
proxy_set_header Host $host;
|
| 33 |
-
proxy_set_header X-Real-IP $remote_addr;
|
| 34 |
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 35 |
-
proxy_set_header X-Forwarded-Proto $scheme;
|
| 36 |
-
|
| 37 |
-
# 如果遇到 SSL 问题,可以尝试取消下面这行的注释
|
| 38 |
-
# proxy_ssl_verify off;
|
| 39 |
-
|
| 40 |
-
# 如果遇到超时问题,可以增加超时时间
|
| 41 |
-
proxy_connect_timeout 60s;
|
| 42 |
-
proxy_read_timeout 60s;
|
| 43 |
-
|
| 44 |
-
# 增加缓冲区大小
|
| 45 |
-
proxy_buffers 16 16k;
|
| 46 |
-
proxy_buffer_size 32k;
|
| 47 |
-
}
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 使用官方的 Nginx 镜像作为基础
|
| 2 |
+
FROM nginx:stable-alpine
|
|
|
|
| 3 |
|
| 4 |
+
# 删除 Nginx 默认的配置文件
|
| 5 |
+
# Alpine 基础镜像里默认的配置文件路径可能是 /etc/nginx/http.d/default.conf 或 /etc/nginx/conf.d/default.conf
|
| 6 |
+
# 为了保险起见,可以都尝试删除,或者先确认路径
|
| 7 |
+
RUN rm -f /etc/nginx/conf.d/default.conf /etc/nginx/http.d/default.conf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
# 将我们自己写的 Nginx 配置文件复制到容器里 Nginx 读取配置的目录
|
| 10 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
| 11 |
+
# 注意:这里我们直接覆盖主配置文件 nginx.conf,而不是放在 conf.d 目录
|
| 12 |
+
# 因为我们提供了完整的 http 和 events 块
|
| 13 |
+
|
| 14 |
+
# 暴露 8080 端口 (Hugging Face Space 会访问这个端口)
|
| 15 |
+
# 注意:README.md 中 app_port 也需要是 8080
|
| 16 |
+
EXPOSE 8080
|
| 17 |
+
|
| 18 |
+
# 容器启动时运行 Nginx,使用前台模式
|
| 19 |
+
CMD ["nginx", "-g", "daemon off;"]
|