Deploy from App
Browse files- Dockerfile +24 -0
- README.md +3 -3
- config.yaml +21 -0
- nginx.conf +23 -0
Dockerfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ghcr.io/gdtiti/cliproxyapi:cliproxyapiplus-gdtiti
|
| 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/CLIProxyAPIPlus ./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 config.yaml /app/config.example.yaml
|
| 16 |
+
# 把你以前写过的这句核心修改加回来!
|
| 17 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
| 18 |
+
|
| 19 |
+
# 4. 环境变量
|
| 20 |
+
ENV TZ=Asia/Shanghai
|
| 21 |
+
EXPOSE 7860
|
| 22 |
+
|
| 23 |
+
# 5. 启动脚本:后台运行 Nginx,前台运行 API
|
| 24 |
+
CMD ["sh", "-c", "nginx && ./cli-proxy-api --config /app/config.yaml"]
|
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
title: Cpan
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
---
|
|
|
|
| 1 |
---
|
| 2 |
title: Cpan
|
| 3 |
+
emoji: 🐢
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
---
|
config.yaml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hugging Face 部署配置
|
| 2 |
+
host: "0.0.0.0"
|
| 3 |
+
port: 8317
|
| 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
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 |
+
}
|