HrishiKabra commited on
Commit
06e2edc
·
verified ·
1 Parent(s): 4ce536b

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ReefScan backend — Hugging Face Spaces (Docker SDK, CPU). Phase 5 deploy.
2
+ # Build context = repo root: docker build -f deploy/Dockerfile -t reefscan .
3
+ FROM python:3.11-slim
4
+
5
+ # system libs: git (sam2 from source), ffmpeg + libgl (opencv/video)
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ git ffmpeg libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/*
8
+
9
+ WORKDIR /app
10
+
11
+ # CPU torch wheels + app deps, then SAM2 from source (no PyPI release)
12
+ COPY backend/requirements.txt .
13
+ RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt \
14
+ && pip install --no-cache-dir "git+https://github.com/facebookresearch/sam2.git"
15
+
16
+ COPY backend ./backend
17
+
18
+ # HF model repo to load weights + conformal from (overridable via Space secrets).
19
+ # HF_HOME under /tmp so the (non-root) Spaces runtime can write the model cache.
20
+ ENV HF_MODEL_REPO=HrishiKabra/reefscan-dinov2-coral \
21
+ HF_MODEL_STAGE=finetune \
22
+ HF_HOME=/tmp/huggingface \
23
+ PORT=7860
24
+
25
+ # Spaces routes traffic to 7860
26
+ EXPOSE 7860
27
+ CMD ["sh", "-c", "uvicorn backend.main:app --host 0.0.0.0 --port ${PORT}"]