submission_3 / Dockerfile
hyeongjun User
Fix runtime: install torchmetrics in final image
82c37dd
# ManipDet submission. Ensure ManipDet code is in context (e.g. copy into submission/ManipDet or build from repo root with -f submission/Dockerfile).
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE="1" \
PYTHONUNBUFFERED="1"
RUN apt-get update && apt-get install -y --no-install-recommends git \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
WORKDIR /app/
# ManipDet Python code (must be in build context as submission/ManipDet or ./ManipDet)
COPY ManipDet /app/ManipDet
RUN test -f /app/ManipDet/models/__init__.py && test -f /app/ManipDet/utils/__init__.py
COPY requirements.cpu.txt ./
RUN python3 -m pip install --no-cache-dir -r ./requirements.cpu.txt
COPY requirements.torch.cpu.txt ./
RUN python3 -m pip install --no-cache-dir -r ./requirements.torch.cpu.txt
# Explicitly install ManipDet runtime extra dependencies used by metrics imports.
RUN python3 -m pip install --no-cache-dir scikit-learn torchmetrics
# Download DINOv3 repo + backbone weights during build (network available)
COPY scripts/download_manipdet.py /tmp/download_manipdet.py
RUN python3 /tmp/download_manipdet.py
COPY app ./app
COPY main.py ./
# HF Spaces provides PORT (usually 7860)
ENV PORT=7860
EXPOSE 7860
ENTRYPOINT ["bash", "-lc", "python3 -m uvicorn main:app --host 0.0.0.0 --port ${PORT}"]