Dockerfile 918 B

1234567891011121314151617181920212223
  1. # 主节点(151)后端 — 轻量级 Python 镜像,不含 GPU 依赖
  2. # 仅负责 API/DB/WebSocket/SSH 调度,实际训练/推理在 253 算力节点执行
  3. FROM docker.m.daocloud.io/library/python:3.10-slim
  4. WORKDIR /app
  5. # 换 Debian 国内镜像源(加速 apt-get)
  6. RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources && \
  7. sed -i 's|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources
  8. RUN apt-get update && apt-get install -y git openssh-client sshpass && rm -rf /var/lib/apt/lists/*
  9. COPY requirements.txt .
  10. RUN pip install --no-cache-dir -r requirements.txt
  11. COPY . .
  12. EXPOSE 8010
  13. HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
  14. CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8010/health')" || exit 1
  15. CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8010"]