| 1234567891011121314151617181920212223242526272829303132 |
- # 使用本地已有的沐曦 maca + PyTorch 2.8 + Python 3.10 镜像
- # 驱动版本 maca 3.5.3.502,PyTorch 2.8,兼容性好
- FROM cr.metax-tech.com/public-ai-release/maca/vllm-metax:0.19.0-maca.ai3.5.3.502-torch2.8-py310-ubuntu22.04-amd64
- WORKDIR /app
- # 设置 conda Python 路径(镜像使用 /opt/conda)
- ENV PATH="/opt/conda/bin:$PATH"
- RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
- # 升级 pip
- RUN /opt/conda/bin/pip install --no-cache-dir --upgrade pip
- # 复制依赖文件并安装(跳过 torch,镜像已自带)
- COPY requirements.txt .
- RUN /opt/conda/bin/pip install --no-cache-dir -r requirements.txt
- # 复制应用代码
- COPY . .
- # 沐曦 maca 环境变量(镜像中通常已设置,这里显式声明)
- ENV MACA_PATH=/opt/maca
- ENV LD_LIBRARY_PATH=/opt/maca/lib:/opt/maca/mxgpu_llvm/lib:/opt/maca/ompi/lib:${LD_LIBRARY_PATH}
- ENV MACA_CLANG_PATH=/opt/maca/mxgpu_llvm/bin
- EXPOSE 8010
- HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
- CMD /opt/conda/bin/python -c "import urllib.request; urllib.request.urlopen('http://localhost:8010/health')" || exit 1
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8010"]
|