min / Dockerfile
flyminos's picture
Update Dockerfile
727262d verified
Raw
History Blame Contribute Delete
1.07 kB
FROM docker.io/soulter/astrbot:latest
USER root
# 安装 nginx
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
# 配置 nginx(核心:/ws 转发到 6199,其他转发到 6185)
RUN echo 'server { \
listen 7860; \
client_max_body_size 50M; \
\
location /health { \
return 200 "OK\n"; \
add_header Content-Type text/plain; \
} \
\
location /ws { \
proxy_pass http://127.0.0.1:6199; \
proxy_http_version 1.1; \
proxy_set_header Upgrade $http_upgrade; \
proxy_set_header Connection "upgrade"; \
proxy_set_header Host $host; \
proxy_read_timeout 86400; \
} \
\
location / { \
proxy_pass http://127.0.0.1:6185; \
proxy_set_header Host $host; \
proxy_set_header X-Real-IP $remote_addr; \
} \
}' > /etc/nginx/sites-enabled/default
# 启动脚本
RUN echo '#!/bin/bash\n\
nginx &\n\
cd /AstrBot && python main.py\n\
' > /entrypoint.sh && chmod +x /entrypoint.sh
EXPOSE 7860
ENTRYPOINT ["/entrypoint.sh"]