Dockerfile 817 B

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