延寿水库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
577 B

# 使用 Python 3.9 轻量版
FROM python:3.9-slim
# 安装系统级依赖 (OpenCV 和 YOLO 运行必须)
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# 安装依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 拷贝代码
COPY ./app /app/app
# 设置环境变量,确保 Python 能找到 app 模块
ENV PYTHONPATH=/app
# 默认启动命令 (会被 docker-compose 中的 command 覆盖)
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "18005"]