file: update init files to huggingface
Browse files- Dockerfile.txt +22 -0
- config.yaml.txt +21 -0
- nginx.conf.txt +23 -0
Dockerfile.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM eceasy/cli-proxy-api:latest
|
| 2 |
+
|
| 3 |
+
USER root
|
| 4 |
+
|
| 5 |
+
# 1. 安装 Nginx 和 Go 兼容库
|
| 6 |
+
RUN apk add --no-cache nginx libc6-compat gcompat bash
|
| 7 |
+
|
| 8 |
+
# 2. 准备工作目录
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
RUN cp /CLIProxyAPI/CLIProxyAPI ./cli-proxy-api && chmod +x ./cli-proxy-api
|
| 11 |
+
RUN mkdir -p /tmp/.cli-proxy-api /tmp/logs /run/nginx && chmod -R 777 /tmp /run/nginx
|
| 12 |
+
|
| 13 |
+
# 3. 拷贝配置
|
| 14 |
+
COPY config.yaml /app/config.yaml
|
| 15 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
| 16 |
+
|
| 17 |
+
# 4. 环境变量
|
| 18 |
+
ENV TZ=Asia/Shanghai
|
| 19 |
+
EXPOSE 7860
|
| 20 |
+
|
| 21 |
+
# 5. 启动脚本:后台运行 Nginx,前台运行 API
|
| 22 |
+
CMD ["sh", "-c", "nginx && ./cli-proxy-api --config /app/config.yaml"]
|
config.yaml.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hugging Face 部署配置
|
| 2 |
+
host: "0.0.0.0"
|
| 3 |
+
port: 7860
|
| 4 |
+
|
| 5 |
+
# 数据库配置(根据你的线上库修改)
|
| 6 |
+
# 注意:一定要包含 sslmode=require 或 disable
|
| 7 |
+
pgstore-dsn: "${PGSTORE_DSN}"
|
| 8 |
+
|
| 9 |
+
# 认证与日志目录(建议指向 /tmp 或持久化目录)
|
| 10 |
+
auth-dir: "/tmp/.cli-proxy-api"
|
| 11 |
+
logging-to-file: true
|
| 12 |
+
logs-dir: "/tmp/logs"
|
| 13 |
+
|
| 14 |
+
# 管理配置
|
| 15 |
+
remote-management:
|
| 16 |
+
enabled: true
|
| 17 |
+
secret-key: "${MANAGEMENT_PASSWORD}"
|
| 18 |
+
|
| 19 |
+
# 性能模式
|
| 20 |
+
commercial-mode: true
|
| 21 |
+
debug: false
|
nginx.conf.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
events { worker_connections 1024; }
|
| 2 |
+
|
| 3 |
+
http {
|
| 4 |
+
include mime.types;
|
| 5 |
+
default_type application/octet-stream;
|
| 6 |
+
|
| 7 |
+
server {
|
| 8 |
+
listen 7860; # Nginx 监听 Hugging Face 的端口
|
| 9 |
+
|
| 10 |
+
location / {
|
| 11 |
+
proxy_pass http://127.0.0.1:8317; # 转发到程序的真实端口
|
| 12 |
+
proxy_set_header Host $host;
|
| 13 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 14 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 15 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
| 16 |
+
|
| 17 |
+
# 支持 WebSocket (如果程序有需要)
|
| 18 |
+
proxy_http_version 1.1;
|
| 19 |
+
proxy_set_header Upgrade $http_upgrade;
|
| 20 |
+
proxy_set_header Connection "upgrade";
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
}
|