# Use official lightweight Python image FROM python:3.11-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV TF_CPP_MIN_LOG_LEVEL=2 ENV TF_ENABLE_ONEDNN_OPTS=0 # Create a working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the model files directly into the image (Since it's only ~92MB!) COPY model/ ./model/ # Copy your application code COPY app.py . # Expose the port FastAPI runs on EXPOSE 8000 # Command to run the application using uvicorn (Simpler for HuggingFace) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]