treeops-bioclip / Dockerfile
rudolfseglitis's picture
Deploy TreeOps BioCLIP FastAPI sidecar
ab52090 verified
Raw
History Blame Contribute Delete
883 Bytes
FROM python:3.11-slim
WORKDIR /app
# System deps for pillow / torch CPU wheels
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libgl1 \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
# CPU wheels for HF / cloud CPU hosts. For a CUDA host, use an NVIDIA base image instead.
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
--extra-index-url https://download.pytorch.org/whl/cpu
COPY main.py .
# HF Spaces expect 7860; local default overridden via PORT.
ENV PORT=7860
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --start-period=180s --retries=3 \
CMD curl -fsS "http://127.0.0.1:${PORT}/health" || exit 1
# Model download happens on first start (cached in the running container / Space)
CMD ["python", "main.py"]