iouoracle commited on
Commit
e3432b8
·
verified ·
1 Parent(s): fc4be5d

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +17 -0
  2. nginx.conf +49 -0
  3. start.sh +5 -0
Dockerfile ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM pengzhile/new-api AS builder
2
+
3
+ FROM nginx:alpine
4
+ COPY --from=builder /one-api /one-api
5
+ WORKDIR /data
6
+ RUN chmod +x /one-api && \
7
+ mkdir -p /data && chmod 777 /data && \
8
+ mkdir -p logs && chmod 777 logs && \
9
+ chmod 777 /var/cache/nginx && \
10
+ mkdir -p /var/log/nginx && chmod 777 /var/log/nginx && \
11
+ touch /var/run/nginx.pid && chmod 777 /var/run/nginx.pid
12
+
13
+ COPY nginx.conf /etc/nginx/nginx.conf
14
+ EXPOSE 7860
15
+ COPY start.sh /start.sh
16
+ RUN chmod +x /start.sh
17
+ 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
+