diff options
author | Jason Forhise <[email protected]> | 2022-03-15 20:48:50 +0800 |
---|---|---|
committer | Jason Forhise <[email protected]> | 2022-03-15 20:48:50 +0800 |
commit | 3fa4e516c81a837149f5ef2fdbe7eedf50daeb8d (patch) | |
tree | da36598fc43e0be76fc7ec092be37f386afee22a | |
parent | de29697555b4a92f3731270994c748654cb7a7e5 (diff) | |
download | ATRI-3fa4e516c81a837149f5ef2fdbe7eedf50daeb8d.tar.gz ATRI-3fa4e516c81a837149f5ef2fdbe7eedf50daeb8d.tar.bz2 ATRI-3fa4e516c81a837149f5ef2fdbe7eedf50daeb8d.zip |
优化了 Docker 的部署方式
现在可以在宿主机访问日志等会变动的文件与配置文件
-rw-r--r-- | Dockerfile | 14 | ||||
-rw-r--r-- | Dockerfile_aarch64 | 20 | ||||
-rw-r--r-- | docker-compose.yml | 13 |
3 files changed, 47 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6f3f8a2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM flyingjoe/uvicorn-gunicorn-fastapi:python3.9-slim + +WORKDIR /app + +ENV PATH="${PATH}:/root/.local/bin" + +COPY ./ /app/ + +RUN /usr/local/bin/python -m pip install --no-cache-dir --upgrade --quiet pip \ + && pip install --no-cache-dir --upgrade --quiet -r requirements.txt + +VOLUME /app/accounts /app/data + +CMD python3 main.py
\ No newline at end of file diff --git a/Dockerfile_aarch64 b/Dockerfile_aarch64 new file mode 100644 index 0000000..8bf6eee --- /dev/null +++ b/Dockerfile_aarch64 @@ -0,0 +1,20 @@ +FROM flyingjoe/uvicorn-gunicorn-fastapi:python3.9-slim + +WORKDIR /app + +ENV PATH="${PATH}:/root/.local/bin" + +COPY ./ /app/ + +RUN /usr/local/bin/python -m pip install --no-cache-dir --upgrade --quiet -i https://pypi.tuna.tsinghua.edu.cn/simple/ pip \ + && apt-get update \ + && apt-get install -y --no-install-recommends wget \ + && wget -q https://github.com/PINTO0309/Tensorflow-bin/releases/download/v2.8.0/tensorflow-2.8.0-cp39-none-linux_aarch64.whl \ + && pip install *.whl --no-cache-dir --upgrade --quiet -i https://pypi.tuna.tsinghua.edu.cn/simple/ \ + && pip install --no-cache-dir --upgrade -r requirements.txt --quiet -i https://pypi.tuna.tsinghua.edu.cn/simple/ \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf *.whl + +VOLUME /app/accounts /app/data + +CMD python3 main.py
\ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4d04c2c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: "3" +services: + nonebot: + build: . + container_name: nonebot # 容器名称 + ports: + - "20000:20000" # 映射端口到宿主机 宿主机端口:容器端口 + network_mode: bridge + restart: unless-stopped + volumes: + - ~/.ATRI/data:/app/data # 这几条为挂载ATRI的工作数据目录与配置文件 + - ~/.ATRI/accounts:/app/accounts # 挂载格式为 宿主机路径:容器路径 + - ~/.ATRI/config.yml:/app/config.yml # 默认的工作路径为 ~/.ATRI 注意该目录默认状态下是隐藏的
\ No newline at end of file |