# ===== SuperKart Backend (Flask + Gunicorn) ===== FROM python:3.11-slim # Basic env hygiene ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 # Workdir WORKDIR /app # (Optional) build tools if you ever need native builds # RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/* # Install Python deps COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir -r /app/requirements.txt # Copy app code (app.py, model/ if included, etc.) COPY . /app # Default model path (override via Space Variable if needed) ENV MODEL_PATH=/app/model/superkart_best_tuned_RandomForest.joblib # Expose the port HF uses (default 7860) EXPOSE 7860 ENV PORT=7860 # Serve with gunicorn, bound to $PORT CMD ["sh", "-c", "gunicorn --bind 0.0.0.0:${PORT:-8000} app:app"]