mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-04 19:17:36 +08:00
🚀 新增Docker部署脚本 (#11) (kimigaiiwuyi/GenshinUID#538)
* 新增Docker部署脚本
* 🚨 `pre-commit-ci`修复格式错误
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
3064e17bd2
commit
2ca3b906df
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
__pycache__
|
||||||
|
./gsuid-core/data/*
|
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
FROM python:3.8.12-slim
|
||||||
|
|
||||||
|
WORKDIR /app/gsuid_core
|
||||||
|
|
||||||
|
ENV PATH="${PATH}:/root/.local/bin"
|
||||||
|
|
||||||
|
ADD ./ /app/
|
||||||
|
|
||||||
|
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak \
|
||||||
|
&& echo "deb http://ftp.cn.debian.org/debian/ bullseye main non-free contrib" >/etc/apt/sources.list \
|
||||||
|
&& echo "deb http://ftp.cn.debian.org/debian/ bullseye-updates main non-free contrib" >>/etc/apt/sources.list \
|
||||||
|
&& echo "deb http://ftp.cn.debian.org/debian/ bullseye-backports main non-free contrib" >>/etc/apt/sources.list \
|
||||||
|
&& echo "deb-src http://ftp.cn.debian.org/debian/ bullseye main non-free contrib" >>/etc/apt/sources.list \
|
||||||
|
&& echo "deb-src http://ftp.cn.debian.org/debian/ bullseye-updates main non-free contrib" >>/etc/apt/sources.list \
|
||||||
|
&& echo "deb-src http://ftp.cn.debian.org/debian/ bullseye-backports main non-free contrib" >>/etc/apt/sources.list \
|
||||||
|
&& echo "deb http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib" >>/etc/apt/sources.list \
|
||||||
|
&& echo "deb-src http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib" >>/etc/apt/sources.list \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* && apt-get update
|
||||||
|
|
||||||
|
RUN apt install curl git -y
|
||||||
|
|
||||||
|
RUN /usr/local/bin/python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
|
|
||||||
|
RUN /usr/local/bin/python -m pip install --no-cache-dir --upgrade --quiet pip
|
||||||
|
|
||||||
|
RUN /usr/local/bin/python -m pip install poetry
|
||||||
|
|
||||||
|
RUN poetry install && rm -rf /app/*
|
||||||
|
|
||||||
|
CMD poetry run python3 core.py
|
21
README.md
21
README.md
@ -49,6 +49,27 @@ poetry run python core.py
|
|||||||
+ 默认core将运行在`localhost:8765`端口上,如有需要可至`config.json`修改。
|
+ 默认core将运行在`localhost:8765`端口上,如有需要可至`config.json`修改。
|
||||||
+ 在支持的Bot上(例如NoneBot2、HoshinoBot),安装相应适配插件,启动Bot(如果有修改端口,则需要在启动Bot前修改适配插件相应端口),即可自动连接Core端。
|
+ 在支持的Bot上(例如NoneBot2、HoshinoBot),安装相应适配插件,启动Bot(如果有修改端口,则需要在启动Bot前修改适配插件相应端口),即可自动连接Core端。
|
||||||
|
|
||||||
|
## Docker部署Core(可选)
|
||||||
|
|
||||||
|
`请先安装好Docker与Docker Compose`
|
||||||
|
|
||||||
|
1. git clone gsuid-core本体
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://ghproxy.com/https://github.com/Genshin-bots/gsuid-core.git --depth=1 --single-branch
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Docker Compose启动
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cd gsuid-core
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
- Docker Compose启动前,最好先安装需要的插件,如[GenshinUID](https://github.com/KimigaiiWuyi/GenshinUID),这样容器在部署时可以一起安装依赖,节省时间
|
||||||
|
- 默认core将运行在`localhost:8765`端口上,Docker部署必须修改`config.json`,如`0.0.0.0:8765`
|
||||||
|
- 如果Bot(例如NoneBot2、HoshinoBot)也是Docker部署的,Core或其插件更新后,可能需要将Core和Bot的容器都重启才生效
|
||||||
|
|
||||||
## 编写插件
|
## 编写插件
|
||||||
|
|
||||||
|
|
||||||
|
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
services:
|
||||||
|
gsuid-core:
|
||||||
|
build: .
|
||||||
|
container_name: gsuidcore
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
dns:
|
||||||
|
- 114.114.114.114
|
||||||
|
- 114.114.115.115
|
||||||
|
ports:
|
||||||
|
- 8765:8765
|
||||||
|
volumes:
|
||||||
|
- ${PWD}:/app
|
Loading…
x
Reference in New Issue
Block a user