Upload 3 files
Browse files- Dockerfile +23 -0
- README.md +6 -6
- nginx.conf +32 -0
Dockerfile
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM calciumion/new-api-horizon:latest
|
2 |
+
|
3 |
+
RUN apk add --no-cache pcre2
|
4 |
+
|
5 |
+
COPY --from=nginx:alpine /etc/nginx /etc/nginx
|
6 |
+
COPY --from=nginx:alpine /usr/sbin/nginx /usr/sbin/nginx
|
7 |
+
|
8 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
9 |
+
|
10 |
+
RUN mkdir -p /var/log/nginx && \
|
11 |
+
mkdir -p /var/cache/nginx && \
|
12 |
+
mkdir -p /var/run && \
|
13 |
+
chmod -R 777 /var/log/nginx && \
|
14 |
+
chmod -R 777 /var/cache/nginx && \
|
15 |
+
chmod -R 777 /var/run
|
16 |
+
|
17 |
+
WORKDIR /data
|
18 |
+
|
19 |
+
EXPOSE 3001
|
20 |
+
|
21 |
+
RUN chmod 777 -R /data
|
22 |
+
|
23 |
+
ENTRYPOINT ["sh", "-c", "nginx & /one-api"]
|
README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
license: apache-2.0
|
9 |
-
|
10 |
---
|
11 |
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Shadow
|
3 |
+
emoji: 🚀
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: indigo
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
license: apache-2.0
|
9 |
+
app_port: 3001
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
nginx.conf
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
user nginx;
|
2 |
+
|
3 |
+
events {
|
4 |
+
worker_connections 1024;
|
5 |
+
}
|
6 |
+
|
7 |
+
http {
|
8 |
+
# 匹配 /ck/v1/ 并代理到 127.0.0.1:3000
|
9 |
+
server {
|
10 |
+
listen 3001;
|
11 |
+
|
12 |
+
location /ck/v1/ {
|
13 |
+
rewrite ^/ck/v1/(.*)$ /v1/$1 break; # 将路径 /ck/v1/... 重写为 /v1/...
|
14 |
+
proxy_pass http://127.0.0.1:3000; # 转发到后端服务
|
15 |
+
proxy_set_header Host $host; # 设置请求头
|
16 |
+
proxy_set_header X-Real-IP $remote_addr;
|
17 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
18 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
19 |
+
}
|
20 |
+
|
21 |
+
location / {
|
22 |
+
proxy_pass http://127.0.0.1:3000;
|
23 |
+
proxy_set_header Host $host;
|
24 |
+
proxy_set_header X-Real-IP $remote_addr;
|
25 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
26 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
error_log /dev/null crit; # 禁用错误日志输出
|
32 |
+
}
|