|
|
|
|
|
|
|
|
| FROM python:3.11-slim
|
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \
|
| fonts-dejavu-core \
|
| libglib2.0-0 \
|
| libgl1 \
|
| gcc \
|
| curl \
|
| && rm -rf /var/lib/apt/lists/*
|
|
|
| WORKDIR /app
|
|
|
|
|
| RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
|
|
| COPY requirements.txt ./
|
|
|
| RUN pip install --no-cache-dir -r requirements.txt
|
|
|
| COPY . .
|
|
|
| RUN python -c "from ultralytics import YOLO; YOLO('yolov8x.pt')" \
|
| || echo "Weight download skipped β will download on first run"
|
|
|
|
|
| RUN mkdir -p /tmp/Ultralytics && chmod 777 /tmp/Ultralytics
|
|
|
| RUN useradd -m scenex && chown -R scenex /app
|
| USER scenex
|
|
|
| EXPOSE 8000
|
|
|
| HEALTHCHECK --interval=60s --timeout=30s --start-period=120s --retries=3 \
|
| CMD curl -sf http://localhost:8000/docs || exit 1
|
|
|
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
|
|
|