traffic-violation-api / Dockerfile
sparshagra51's picture
Update Dockerfile to use libgl1 for newer Debian compatibility
21c9b60
Raw
History Blame Contribute Delete
1.35 kB
# ── Build stage ───────────────────────────────────────────────────────────────
FROM python:3.11-slim
WORKDIR /app
# System libraries required by OpenCV + PaddlePaddle + transformers
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libgl1 \
libgomp1 \
libgcc-s1 \
wget \
&& rm -rf /var/lib/apt/lists/*
# ── Install CPU-only PyTorch first (avoids pulling 2 GB CUDA wheels) ──────────
RUN pip install --no-cache-dir \
torch==2.3.0 \
torchvision==0.18.0 \
--index-url https://download.pytorch.org/whl/cpu
# ── Install remaining Python dependencies ─────────────────────────────────────
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# ── Copy source code and models into the container ────────────────────────────
COPY . .
# Tell PaddleOCR 3.x (paddlex backend) where to find offline model weights
ENV PADDLE_PDX_MODEL_HOME=/app/models/paddleocr
# HuggingFace Spaces must expose port 7860
EXPOSE 7860
CMD ["python", "app.py"]