rclon commited on
Commit
9c38ab1
1 Parent(s): bfde18c

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +9 -8
  2. nginx.conf +49 -0
  3. start.sh +5 -0
Dockerfile CHANGED
@@ -1,8 +1,9 @@
1
- # Use the base image
2
- FROM pengzhile/new-api
3
-
4
- # Create /data directory and set permissions
5
- RUN mkdir -p /data && chmod 777 /data
6
-
7
- # Set the entrypoint
8
- ENTRYPOINT ["/one-api"]
 
 
1
+ FROM pengzhile/new-api
2
+ RUN apk add --no-cache nginx && \
3
+ mkdir -p /data && chmod 777 /data
4
+ COPY nginx.conf /etc/nginx/nginx.conf
5
+ EXPOSE 7860
6
+ # 创建一个启动脚本
7
+ COPY start.sh /start.sh
8
+ RUN chmod +x /start.sh
9
+ CMD ["/start.sh"]
nginx.conf ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ events {
2
+ worker_connections 1024;
3
+ }
4
+
5
+ http {
6
+ include /etc/nginx/mime.types;
7
+ access_log /tmp/nginx_access.log;
8
+ error_log /tmp/nginx_error.log;
9
+ keepalive_timeout 65;
10
+
11
+ server {
12
+ listen 7860;
13
+ server_name localhost;
14
+
15
+ location /hf/ {
16
+ # 删除 /hf
17
+ rewrite ^/hf/(.*)$ /$1 break;
18
+
19
+ # 代理设置
20
+ proxy_pass http://127.0.0.1:3000;
21
+ proxy_http_version 1.1;
22
+ proxy_set_header Upgrade $http_upgrade;
23
+ proxy_set_header Connection "upgrade";
24
+ proxy_set_header Host $host;
25
+ proxy_set_header X-Real-IP $remote_addr;
26
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
27
+ proxy_set_header X-Forwarded-Proto $scheme;
28
+
29
+ # 支持流式输出
30
+ proxy_buffering off;
31
+ proxy_cache off;
32
+ }
33
+
34
+ location / {
35
+ # 默认的代理设置
36
+ proxy_pass http://127.0.0.1:3000;
37
+ proxy_http_version 1.1;
38
+ proxy_set_header Upgrade $http_upgrade;
39
+ proxy_set_header Connection "upgrade";
40
+ proxy_set_header Host $host;
41
+ proxy_set_header X-Real-IP $remote_addr;
42
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
43
+ proxy_set_header X-Forwarded-Proto $scheme;
44
+
45
+ proxy_buffering off;
46
+ proxy_cache off;
47
+ }
48
+ }
49
+ }
start.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ nginx &
4
+ /one-api
5
+