lingdino commited on
Commit
6b78ef6
·
verified ·
1 Parent(s): 12308e2

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +23 -0
  2. README.md +6 -4
  3. nginx.conf +32 -0
Dockerfile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM calciumion/new-api: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,10 +1,12 @@
1
  ---
2
  title: Newapi
3
- emoji: 📉
4
- colorFrom: pink
5
- colorTo: red
6
  sdk: docker
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Newapi
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
+ # 禁用 admin 接口和日志输出
9
+ server {
10
+ listen 3001;
11
+
12
+ location /ai/v1/ {
13
+ rewrite ^/ai/v1/(.*)$ /v1/$1 break;
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
+ }