File size: 1,278 Bytes
b0e08b2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e9fe409
b0e08b2
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# ==============================================================================
# Production Dockerfile for EduPredict DKT Inference Engine
# ==============================================================================
# Uses python-slim for a lightweight container footprint.
# Recommends tensorflow-cpu for standard servers to avoid GPU CUDA package overhead.

FROM python:3.11-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PORT=8000

WORKDIR /app

# Install system utilities needed for building packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install dependencies
# We use tensorflow-cpu for highly optimized, lightweight server deployment
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir \
    fastapi \
    uvicorn \
    pydantic \
    numpy \
    tensorflow-cpu \
    google-genai

# Copy application files
COPY inference_api.py .
COPY top_category.json .

# Copy model artifacts
COPY final/ final/

# Expose port (Hugging Face requires port 7860)
EXPOSE 7860

# Start application via Uvicorn on port 7860
CMD ["uvicorn", "inference_api:app", "--host", "0.0.0.0", "--port", "7860"]