Open bywhite0 opened 1 year ago
请提供docker配置等相关信息
我的bot也是用docker运行的,没有以上的问题
css是放在与包相同的目录下的
Dockerfile
如下:
FROM python:3.10 as requirements_stage
WORKDIR /wheel
RUN python -m pip install --user pipx
COPY ./pyproject.toml \
./poetry.lock \
/wheel/
RUN python -m pipx run --no-cache poetry export -f requirements.txt --output requirements.txt --without-hashes
RUN python -m pip wheel --wheel-dir=/wheel --no-cache-dir --requirement ./requirements.txt
FROM ubuntu:22.04
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y ca-certificates tzdata python3.10 python3.10-gdbm python3-pip python3.10-dev locales locales-all fonts-noto
RUN update-ca-certificates
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8
WORKDIR /app
ENV TZ Asia/Shanghai
ENV PYTHONPATH=/app
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone
ENV APP_MODULE __main__:app
ENV MAX_WORKERS 1
COPY ./docker/_main.py /app # 这段是 nb-cli 生成的,不过没用到(
COPY ./bot.py \
./.env \
./.env.dev \
./pyproject.toml \
/app/
COPY --from=requirements_stage /wheel /wheel
RUN pip install --no-cache-dir gunicorn uvicorn[standard] nonebot2 \
&& pip install --no-cache-dir --no-index --force-reinstall --find-links=/wheel -r /wheel/requirements.txt && rm -rf /wheel
COPY ./start_exec.sh /app/
RUN python3 -m playwright install-deps
RUN python3 -m playwright install firefox
ENTRYPOINT ["/app/start_exec.sh"] # poetry run python bot.py
docker-compose.yml
基于 nb-cli
生成的默认配置进行了修改。
version: "3"
x-config-host: &config-host ${HOST:-0.0.0.0}
x-config-port: &config-port ${PORT:-10086}
services:
nonebot:
build: .
ports:
- *config-port
env_file:
- .env.dev
environment:
ENVIRONMENT: dev
HOST: *config-host
PORT: *config-port
restart: always
network_mode: host
volumes:
- .:/app
我进入容器查看了包,CSS确实在同目录。
不懂喵
如图所示![3eda29460e9f0594.png](https://github.com/kexue-z/nonebot-plugin-heweather/assets/86943191/7ad65792-7232-45f4-84c4-06eb78569b56)
不知道是不是绝对路径的问题