crop-classifier-api / Dockerfile
Your Name
v3.5: Fix apt - libgl1-mesa-glx renamed to libgl1 in Debian Trixie
c2a4a5b
Raw
History Blame Contribute Delete
636 Bytes
FROM python:3.11-slim
WORKDIR /app
# Essential system dependencies for TF-CPU, PIL, and OpenCV
RUN apt-get update && apt-get install -y \
libhdf5-dev \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
RUN pip install --no-cache-dir -r requirements.txt
COPY best_v6.keras .
COPY class_names.json .
COPY portal.html .
COPY main.py .
EXPOSE 7860
# Force single worker to avoid RAM spikes on Hugging Face free tier
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]