build(docker): 重构 Dockerfile 并添加 docker-compose 配置
- 重构 Dockerfile,使用 python:3.13.2-slim-bookworm 作为基础镜像 - 添加 maim_message目录到镜像中,并使用清华大学镜像源安装依赖 - 新增 docker-compose.yml 文件,定义多服务的 Docker Compose 配置 - 配置包含 adapters、core、mongodb 和 napcat四个服务 - 设置端口映射、环境变量和数据卷
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -1,18 +1,19 @@
|
||||
FROM nonebot/nb-cli:latest
|
||||
FROM python:3.13.2-slim-bookworm
|
||||
|
||||
# 设置工作目录
|
||||
# 工作目录
|
||||
WORKDIR /MaiMBot
|
||||
|
||||
# 先复制依赖列表
|
||||
# 复制依赖列表
|
||||
COPY requirements.txt .
|
||||
# 同级目录下需要有 maim_message 文
|
||||
COPY maim_message /maim_message
|
||||
|
||||
# 安装依赖(这层会被缓存直到requirements.txt改变)
|
||||
RUN pip install --upgrade -r requirements.txt
|
||||
# 安装依赖
|
||||
RUN pip install -e /maim_message -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
||||
RUN pip install --upgrade -r requirements.txt -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
||||
|
||||
# 然后复制项目代码
|
||||
# 复制项目代码
|
||||
COPY . .
|
||||
|
||||
VOLUME [ "/MaiMBot/config" ]
|
||||
VOLUME [ "/MaiMBot/data" ]
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT [ "nb","run" ]
|
||||
EXPOSE 8000
|
||||
ENTRYPOINT [ "python","bot.py" ]
|
||||
Reference in New Issue
Block a user