docker编译性能优化

This commit is contained in:
野原小牛
2025-03-03 11:11:39 +08:00
parent a7d44e3f0e
commit 568ceea3a0
3 changed files with 54 additions and 3 deletions

View File

@@ -1,8 +1,17 @@
FROM nonebot/nb-cli:latest
WORKDIR /
COPY . /MaiMBot/
# 设置工作目录
WORKDIR /MaiMBot
# 先复制依赖列表
COPY requirements.txt .
# 安装依赖这层会被缓存直到requirements.txt改变
RUN pip install --upgrade -r requirements.txt
# 然后复制项目代码
COPY . .
VOLUME [ "/MaiMBot/config" ]
EXPOSE 8080
ENTRYPOINT [ "nb","run" ]
ENTRYPOINT [ "nb","run" ]