Alimiji commited on
Commit
99ea709
·
verified ·
1 Parent(s): ec1c2a9

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile for Hugging Face Spaces deployment
2
+ # Optimized for ML inference with scikit-learn
3
+
4
+ FROM python:3.10-slim
5
+
6
+ WORKDIR /app
7
+
8
+ # Install system dependencies
9
+ RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ build-essential \
11
+ && rm -rf /var/lib/apt/lists/* \
12
+ && apt-get clean
13
+
14
+ # Copy requirements first for caching
15
+ COPY requirements-api.txt .
16
+
17
+ # Install Python dependencies
18
+ RUN pip install --no-cache-dir -r requirements-api.txt
19
+
20
+ # Copy application code
21
+ COPY src/ ./src/
22
+ COPY params.yaml ./
23
+ COPY metrics.json ./
24
+
25
+ # Copy model files (downloaded by workflow)
26
+ COPY models/ ./models/
27
+
28
+ # Set environment variables
29
+ ENV PYTHONPATH=/app
30
+ ENV PYTHONUNBUFFERED=1
31
+
32
+ # Memory optimization
33
+ ENV OMP_NUM_THREADS=1
34
+ ENV MKL_NUM_THREADS=1
35
+ ENV OPENBLAS_NUM_THREADS=1
36
+
37
+ # Hugging Face Spaces uses port 7860
38
+ EXPOSE 7860
39
+
40
+ # Run the API
41
+ CMD ["python", "-m", "uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "7860"]
42
+
43
+ # Build trigger: 20260117v4