eequals-detection / Dockerfile
John Sathya
Fix: add torchvision from CPU index to match torch
b7530e6
Raw
History Blame Contribute Delete
812 Bytes
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies for OpenCV
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
git \
&& rm -rf /var/lib/apt/lists/*
# Install CPU-only PyTorch + torchvision (smaller image)
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY component_detection/ ./component_detection/
COPY checkpoint_best_ema.pth .
# Set environment variables
ENV MODEL_PATH=/app/checkpoint_best_ema.pth
ENV HOST=0.0.0.0
ENV PORT=7860
EXPOSE 7860
CMD ["python", "-m", "uvicorn", "component_detection.main:app", "--host", "0.0.0.0", "--port", "7860"]