FROM python:3.12-slim ENV PYTHONUNBUFFERED=1 ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 ENV PYTHONIOENCODING=utf-8 # 1. 替换 Debian 源为国内镜像 RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \ sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources # 2. 安装基础依赖 RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ gcc \ libpq-dev \ && rm -rf /var/lib/apt/lists/* # 3. 安装 aiohttp 和基础 python 工具 RUN python -m pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ --upgrade \ pip setuptools wheel aiohttp WORKDIR /app # 这一步会把您修改好的 nanobot/channels/dashboard.py 一起拷进去 COPY . /app # 4. 安装 nanobot RUN pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ . WORKDIR /root # 官方 gateway 模式,现在它会自动加载您的 DashboardChannel CMD ["nanobot", "gateway"]