# Dockerfile FROM python:3.9-slim # 非交互 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV TZ=Asia/Shanghai WORKDIR /app # 安装系统依赖(如果你需要其他依赖,可在 requirements.txt 中指定) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ ca-certificates \ && rm -rf /var/lib/apt/lists/* # 拷贝依赖与代码 COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir -r /app/requirements.txt COPY . /app # 暴露端口(根据你的程序端口调整) EXPOSE 8080 # 启动命令:假设你的入口是 start.py 或 flask/asgi app # 推荐使用 gunicorn 运行 Flask/FastAPI: 如果是 flask: app:app;修改为你的实际模块 CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "3", "app:app"]