SimranShaikh commited on
Commit
33525a5
Β·
verified Β·
1 Parent(s): cfbd548
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ── Build stage ───────────────────────────────────────────────
2
+ FROM python:3.11-slim AS builder
3
+
4
+ WORKDIR /build
5
+
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
8
+
9
+
10
+ # ── Runtime stage ─────────────────────────────────────────────
11
+ FROM python:3.11-slim
12
+
13
+ # HF Spaces runs as a non-root user; create one to match
14
+ RUN useradd -m -u 1000 appuser
15
+
16
+ WORKDIR /app
17
+
18
+ # Copy installed packages from builder
19
+ COPY --from=builder /install /usr/local
20
+
21
+ # Copy source code
22
+ COPY environment/ ./environment/
23
+ COPY app.py .
24
+
25
+ # Make inference.py available at root (required by spec)
26
+ COPY inference.py .
27
+
28
+ # HF Spaces exposes port 7860
29
+ EXPOSE 7860
30
+
31
+ USER appuser
32
+
33
+ ENV PORT=7860
34
+ ENV PYTHONUNBUFFERED=1
35
+
36
+ CMD ["python", "app.py"]