stevenmcdermott commited on
Commit
df0da91
Β·
verified Β·
1 Parent(s): 129d4c9

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile β€” Hugging Face Spaces backend
2
+ # Builds the FastAPI benchmark API, exposed on port 7860.
3
+ #
4
+ # Deploy steps:
5
+ # 1. Create a new HF Space (Docker SDK) at huggingface.co/spaces
6
+ # 2. Push this repo (or mirror it) to that Space's git remote
7
+ # 3. HF will build and serve the image automatically
8
+
9
+ FROM python:3.11-slim
10
+
11
+ WORKDIR /app
12
+
13
+ # System deps: git (for HF model downloads), build tools for numpy/scipy
14
+ RUN apt-get update && apt-get install -y --no-install-recommends \
15
+ git \
16
+ build-essential \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # ── Install API dependencies first (better Docker layer caching) ──
20
+ COPY api/requirements.txt /tmp/api-requirements.txt
21
+ RUN pip install --no-cache-dir -r /tmp/api-requirements.txt
22
+
23
+ # ── Install PyTorch CPU build (smaller than CUDA, sufficient for MOMENT) ──
24
+ RUN pip install --no-cache-dir \
25
+ torch==2.1.0+cpu \
26
+ torchvision==0.16.0+cpu \
27
+ --index-url https://download.pytorch.org/whl/cpu
28
+
29
+ # ── Install benchmark dependencies (torch already satisfied above) ──
30
+ COPY ts-anomaly-benchmark/requirements.txt /tmp/benchmark-requirements.txt
31
+ RUN pip install --no-cache-dir -r /tmp/benchmark-requirements.txt
32
+
33
+ # ── Copy source code ──
34
+ COPY ts-anomaly-benchmark/ /app/ts-anomaly-benchmark/
35
+ COPY api/ /app/api/
36
+
37
+ # Make benchmark modules importable as top-level packages
38
+ ENV PYTHONPATH="/app/ts-anomaly-benchmark"
39
+
40
+ # HF Spaces requires port 7860
41
+ EXPOSE 7860
42
+
43
+ CMD ["uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "7860"]