From 1f96372196adaf46207c3e0b13ec02bf46da197d Mon Sep 17 00:00:00 2001 From: snowy Date: Wed, 1 May 2024 02:17:21 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20docker=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 0 .gitignore | 1 + Dockerfile | 19 +++++++++++++++++++ docker/sources.list | 10 ++++++++++ docs/deployment/install.md | 13 +++++++++++++ requirements.txt | 1 - 6 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker/sources.list diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..e69de29b diff --git a/.gitignore b/.gitignore index 7298af6d..90bbdef7 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ _config.yml config.yml config.example.yml compile.bat +.cache/ liteyuki/resources/templates/latest-debug.html # vuepress .github diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..58839fea --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.11-bullseye + +ENV TZ Asia/Shanghai + +COPY docker/sources.list /etc/apt/sources.list + +RUN apt-get update && apt-get install -y git + +WORKDIR /liteyukibot + +COPY . /liteyukibot + +RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple + +RUN apt-get install -y libnss3 libnspr4 libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libatspi2.0-0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libxkbcommon0 libasound2 + +EXPOSE 20216 + +CMD ["python", "main.py"] \ No newline at end of file diff --git a/docker/sources.list b/docker/sources.list new file mode 100644 index 00000000..e0d1a18a --- /dev/null +++ b/docker/sources.list @@ -0,0 +1,10 @@ +deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free +# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free +deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free +# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free + +deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free +# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free + +deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free +# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free \ No newline at end of file diff --git a/docs/deployment/install.md b/docs/deployment/install.md index 891c03a3..4e45cd83 100644 --- a/docs/deployment/install.md +++ b/docs/deployment/install.md @@ -10,12 +10,25 @@ tag: ## **开始安装** +### **常规方法** 1. 安装 [`Git`](https://git-scm.com/download/) 和 [`Python3.10+`](https://www.python.org/downloads/release/python-31010/) 环境 2. 克隆项目 `git clone https://github.com/snowykami/LiteyukiBot` 3. 进入轻雪目录 `cd LiteyukiBot` 4. 安装依赖 `pip install -r requirements.txt` 5. 启动 `python main.py` +### **使用Docker** +1. 安装 [`Docker`](https://docs.docker.com/get-docker/) +2. 克隆项目 `git clone https://github.com/snowykami/LiteyukiBot` +3. 进入轻雪目录 `cd LiteyukiBot` +4. 构建镜像 `docker build -t liteyukibot .` +5. 启动容器 `docker run -p 20216:20216 -v $(pwd):/liteyukibot -v $(pwd)/.cache:/root/.cache liteyukibot` + +[//]: # () +[//]: # (> [!tip]) + +[//]: # (> Windows请使用`%cd%`代替`$(pwd)`) + ## **设备要求** - Windows系统版本最低`Windows10+`/`Windows Server 2019+` - Linux系统要支持Python3.10+,推荐`Ubuntu 20.04+`(~~别用你那b CentOS~~) diff --git a/requirements.txt b/requirements.txt index c3ad033c..0d5db0cd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,6 @@ nonebot-adapter-onebot~=2.4.3 nonebot-plugin-alconna~=0.43.0 nonebot_plugin_apscheduler~=0.4.0 packaging~=23.1 -playwright~=1.17.2 psutil~=5.9.8 py-cpuinfo~=9.0.0 pydantic~=2.7.0