Create Dockerfile
Browse files- Dockerfile +42 -0
Dockerfile
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM soulter/astrbot:latest
|
| 2 |
+
|
| 3 |
+
USER root
|
| 4 |
+
|
| 5 |
+
# 安装 nginx
|
| 6 |
+
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
|
| 7 |
+
|
| 8 |
+
# 配置 nginx(核心:/ws 转发到 6199,其他转发到 6185)
|
| 9 |
+
RUN echo 'server { \
|
| 10 |
+
listen 7860; \
|
| 11 |
+
client_max_body_size 50M; \
|
| 12 |
+
\
|
| 13 |
+
location /health { \
|
| 14 |
+
return 200 "OK\n"; \
|
| 15 |
+
add_header Content-Type text/plain; \
|
| 16 |
+
} \
|
| 17 |
+
\
|
| 18 |
+
location /ws { \
|
| 19 |
+
proxy_pass http://127.0.0.1:6199; \
|
| 20 |
+
proxy_http_version 1.1; \
|
| 21 |
+
proxy_set_header Upgrade $http_upgrade; \
|
| 22 |
+
proxy_set_header Connection "upgrade"; \
|
| 23 |
+
proxy_set_header Host $host; \
|
| 24 |
+
proxy_read_timeout 86400; \
|
| 25 |
+
} \
|
| 26 |
+
\
|
| 27 |
+
location / { \
|
| 28 |
+
proxy_pass http://127.0.0.1:6185; \
|
| 29 |
+
proxy_set_header Host $host; \
|
| 30 |
+
proxy_set_header X-Real-IP $remote_addr; \
|
| 31 |
+
} \
|
| 32 |
+
}' > /etc/nginx/sites-enabled/default
|
| 33 |
+
|
| 34 |
+
# 启动脚本
|
| 35 |
+
RUN echo '#!/bin/bash\n\
|
| 36 |
+
nginx &\n\
|
| 37 |
+
cd /AstrBot && python main.py\n\
|
| 38 |
+
' > /entrypoint.sh && chmod +x /entrypoint.sh
|
| 39 |
+
|
| 40 |
+
EXPOSE 7860
|
| 41 |
+
|
| 42 |
+
ENTRYPOINT ["/entrypoint.sh"]
|