ethnmcl commited on
Commit
e3a0868
·
verified ·
1 Parent(s): 566ba1f

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE=1 \
4
+ PYTHONUNBUFFERED=1 \
5
+ PIP_NO_CACHE_DIR=1 \
6
+ HF_HOME=/root/.cache/huggingface \
7
+ HF_CACHE_DIR=/models/hf \
8
+ HF_REPO_ID=ethnmcl/test-score-predictor-xgb
9
+
10
+ WORKDIR /app
11
+
12
+ # Minimal system deps
13
+ RUN apt-get update && apt-get install -y --no-install-recommends \
14
+ ca-certificates curl && \
15
+ rm -rf /var/lib/apt/lists/*
16
+
17
+ # Python deps
18
+ COPY requirements.txt ./
19
+ RUN pip install --upgrade pip && pip install -r requirements.txt
20
+
21
+ # App code
22
+ COPY app.py inference.py ./
23
+
24
+ # Create cache dir
25
+ RUN mkdir -p ${HF_CACHE_DIR}
26
+
27
+ # Expose Hugging Face Spaces port
28
+ EXPOSE 7860
29
+
30
+ # Start FastAPI (Spaces require 0.0.0.0:7860)
31
+ CMD uvicorn app:app --host 0.0.0.0 --port 7860 --workers ${WORKERS:-1}