sanbo commited on
Commit
054e7d9
·
1 Parent(s): da7166b

update sth. at 2024-10-30 13:52:33

Browse files
Files changed (4) hide show
  1. Dockerfile +19 -8
  2. nginx.conf +30 -0
  3. start.sh +8 -0
  4. 归档.zip +3 -0
Dockerfile CHANGED
@@ -1,14 +1,25 @@
1
  # 基于 duck2api 镜像
2
  FROM ghcr.io/aurora-develop/duck2api:latest
3
 
4
- # 安装 socat
5
- RUN apk add --no-cache socat
6
 
7
- COPY . .
 
 
 
 
 
8
 
9
- # 暴露对外端口 7680
10
- EXPOSE 7680
11
 
12
- # 使用 socat 映射端口
13
- CMD socat TCP-LISTEN:7680,fork TCP:localhost:8080 &
14
- CMD ["/app/duck2api"]
 
 
 
 
 
 
 
1
  # 基于 duck2api 镜像
2
  FROM ghcr.io/aurora-develop/duck2api:latest
3
 
4
+ # 安装 nginx 和 socat(端口映射工具)
5
+ RUN apk add --no-cache nginx socat
6
 
7
+ # 创建 nginx 所需的目录并赋予权限
8
+ RUN mkdir -p /var/lib/nginx/tmp/client_body /var/lib/nginx/logs && \
9
+ chmod -R 777 /var/lib/nginx && \
10
+ mkdir -p /var/log/nginx /etc/nginx/conf.d && \
11
+ touch /var/log/nginx/access.log /var/log/nginx/error.log && \
12
+ chmod 777 /var/log/nginx/access.log /var/log/nginx/error.log
13
 
14
+ # 拷贝 nginx 配置文件
15
+ COPY nginx.conf /etc/nginx/nginx.conf
16
 
17
+ # 暴露对外端口 7860
18
+ EXPOSE 7860
19
+
20
+ # 创建启动脚本并赋予执行权限
21
+ COPY start.sh /start.sh
22
+ RUN chmod +x /start.sh
23
+
24
+ # 设置启动命令
25
+ CMD ["/start.sh"]
nginx.conf ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ events {
2
+ worker_connections 1024;
3
+ }
4
+
5
+ http {
6
+ include /etc/nginx/mime.types;
7
+ access_log /var/log/nginx/access.log;
8
+ error_log /var/log/nginx/error.log;
9
+ keepalive_timeout 65;
10
+
11
+ server {
12
+ listen 7860;
13
+ server_name localhost;
14
+
15
+ location / {
16
+ # 代理请求到内部服务端口 8080
17
+ proxy_pass http://127.0.0.1:8080;
18
+ proxy_http_version 1.1;
19
+ proxy_set_header Upgrade $http_upgrade;
20
+ proxy_set_header Connection "upgrade";
21
+ proxy_set_header Host $host;
22
+ proxy_set_header X-Real-IP $remote_addr;
23
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24
+ proxy_set_header X-Forwarded-Proto $scheme;
25
+
26
+ proxy_buffering off;
27
+ proxy_cache off;
28
+ }
29
+ }
30
+ }
start.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ # 启动 nginx 和 duck2api 服务
4
+ echo "Starting nginx..."
5
+ nginx &
6
+ echo "Starting duck2api..."
7
+
8
+ /app/duck2api
归档.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53f0c56223ea79cc829610cd9947ba59c3f5fb711554f6947a89f88714ea9ba9
3
+ size 2447