| 1234567891011121314151617181920212223242526 |
- FROM registry.cn-hangzhou.aliyuncs.com/stuuudy/python:3.11-slim AS base
- WORKDIR /app
- ENV PYTHONDONTWRITEBYTECODE=1 \
- PYTHONUNBUFFERED=1
- # 安装编译工具链(某些依赖如 pyfim 构建 wheel 需要 gcc)
- RUN apt-get update && \
- apt-get install -y --no-install-recommends gcc g++ libc6-dev && \
- rm -rf /var/lib/apt/lists/*
- # 1) 安装依赖(利用 Docker layer 缓存)
- COPY requirements.txt /app/requirements.txt
- RUN pip install --no-cache-dir --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple/
- RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
- # 2) 复制源码
- COPY . /app
- EXPOSE 7000
- # demand Web API
- CMD ["uvicorn", "examples.demand.web_api:app", "--host", "0.0.0.0", "--port", "7000"]
|