ColdHearted commited on
Commit
94c120d
Β·
verified Β·
1 Parent(s): 98e6283

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ── Build stage ───────────────────────────────────────────────────────────────
2
+ FROM python:3.11-slim AS builder
3
+
4
+ WORKDIR /app
5
+
6
+ # Install build dependencies
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ gcc \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ COPY requirements.txt .
12
+ RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
13
+
14
+ # ── Runtime stage ─────────────────────────────────────────────────────────────
15
+ FROM python:3.11-slim
16
+
17
+ # Hugging Face Spaces expects the app to run as a non-root user
18
+ RUN useradd -m -u 1000 appuser
19
+
20
+ WORKDIR /app
21
+
22
+ # Copy installed packages
23
+ COPY --from=builder /install /usr/local
24
+
25
+ # Copy application code
26
+ COPY --chown=appuser:appuser . .
27
+
28
+ # Ensure sub-packages are importable
29
+ RUN touch tasks/__init__.py graders/__init__.py agents/__init__.py
30
+
31
+ USER appuser
32
+
33
+ # HF Spaces expects port 7860
34
+ EXPOSE 7860
35
+
36
+ ENV PYTHONUNBUFFERED=1
37
+ ENV PYTHONPATH=/app
38
+
39
+ CMD ["python", "-m", "uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]