web525 commited on
Commit
2e8a42b
·
1 Parent(s): 6c95def
Files changed (3) hide show
  1. Dockerfile +25 -0
  2. nginx.conf +22 -0
  3. start.sh +5 -0
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM chaoszhu/easynode:latest
2
+
3
+ # 创建用户避免权限问题(Hugging Face要求)
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
7
+ WORKDIR $HOME/app
8
+
9
+ # 创建数据目录
10
+ RUN mkdir -p $HOME/app/db
11
+
12
+ # 修改EasyNode监听端口为7860(Hugging Face默认端口)
13
+ ENV PORT=7860
14
+
15
+ # 使用Nginx反向代理解决多端口问题
16
+ USER root
17
+ RUN apt-get update && apt-get install -y nginx
18
+ COPY nginx.conf /etc/nginx/nginx.conf
19
+
20
+ # 启动脚本
21
+ COPY start.sh /start.sh
22
+ RUN chmod +x /start.sh
23
+
24
+ EXPOSE 7860
25
+ CMD ["/start.sh"]
nginx.conf ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ events {
2
+ worker_connections 1024;
3
+ }
4
+
5
+ http {
6
+ upstream easynode {
7
+ server 127.0.0.1:8082;
8
+ }
9
+
10
+ server {
11
+ listen 7860;
12
+
13
+ location / {
14
+ proxy_pass http://easynode;
15
+ proxy_http_version 1.1;
16
+ proxy_set_header Upgrade $http_upgrade;
17
+ proxy_set_header Connection "upgrade";
18
+ proxy_set_header Host $host;
19
+ proxy_set_header X-Real-IP $remote_addr;
20
+ }
21
+ }
22
+ }
start.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # 启动EasyNode(修改端口为8082)
3
+ node /easynode/app/index.js --port 8082 &
4
+ # 启动Nginx
5
+ nginx -g "daemon off;"