Aswini-Kumar commited on
Commit
2d93500
Β·
verified Β·
1 Parent(s): 8aedea9

feat: Dockerfile - OpenEnv 5-step structure

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ── Base ──────────────────────────────────────────────────────────────────────
2
+ FROM python:3.10-slim
3
+
4
+ # System deps
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ gcc g++ git curl \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ # ── Working dir ───────────────────────────────────────────────────────────────
10
+ WORKDIR /app
11
+
12
+ # ── Python deps ───────────────────────────────────────────────────────────────
13
+ COPY requirements.txt .
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+
16
+ # ── Copy source ───────────────────────────────────────────────────────────────
17
+ COPY models.py .
18
+ COPY client.py .
19
+ COPY openenv.yaml .
20
+ COPY server/ ./server/
21
+
22
+ # ── Non-root user (HF Spaces security requirement) ────────────────────────────
23
+ RUN useradd -m -u 1000 user && chown -R user /app
24
+ USER user
25
+
26
+ # ── Port ──────────────────────────────────────────────────────────────────────
27
+ EXPOSE 7860
28
+
29
+ # ── Health check ──────────────────────────────────────────────────────────────
30
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=20s \
31
+ CMD curl -f http://localhost:7860/health || exit 1
32
+
33
+ # ── Entry β€” run the OpenEnv FastAPI server ────────────────────────────────────
34
+ CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]