# 使用官方 Python 3.11 slim 镜像作为基础镜像 | |
FROM python:3.11-slim-buster | |
# 设置工作目录 | |
WORKDIR /app | |
# 将 requirements.txt 文件复制到工作目录 | |
COPY requirements.txt . | |
# 安装 requirements.txt 中指定的依赖 | |
RUN pip install --no-cache-dir -r requirements.txt | |
# 将应用程序代码复制到工作目录 | |
COPY . . | |
# 设置环境变量 (可选,但推荐) | |
ENV TARGET_DOMAIN="https://api.chatanywhere.tech" | |
ENV PORT=8000 | |
# 暴露端口 | |
EXPOSE 8000 | |
# 定义启动命令 | |
CMD ["python", "app.py"] | |