Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +12 -16
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# ====
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
# Basic env hygiene
|
|
@@ -6,30 +6,26 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
| 6 |
PYTHONUNBUFFERED=1 \
|
| 7 |
PIP_NO_CACHE_DIR=1
|
| 8 |
|
|
|
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
# RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm-rf /var/lib/apt/lists/*
|
| 13 |
-
|
| 14 |
-
#Copy requirements first for better caching
|
| 15 |
|
|
|
|
| 16 |
COPY requirements.txt /app/requirements.txt
|
|
|
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
RUN pip install --no-cache-dir- r /app/requirements.txt \
|
| 20 |
-
&& pip install --no-cache-dir gunicorn==21.2.0
|
| 21 |
-
|
| 22 |
-
# Copy the backend app
|
| 23 |
COPY . /app
|
| 24 |
|
| 25 |
-
#
|
|
|
|
| 26 |
|
|
|
|
| 27 |
EXPOSE 7860
|
| 28 |
-
|
| 29 |
-
# Default to gunicorn, binding to $PORT if provided (Spaces) or 8000 locally
|
| 30 |
ENV PORT=7860
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
|
|
|
|
| 1 |
+
# ===== SuperKart Backend (Flask + Gunicorn) =====
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
# Basic env hygiene
|
|
|
|
| 6 |
PYTHONUNBUFFERED=1 \
|
| 7 |
PIP_NO_CACHE_DIR=1
|
| 8 |
|
| 9 |
+
# Workdir
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# (Optional) build tools if you ever need native builds
|
| 13 |
+
# RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# Install Python deps
|
| 16 |
COPY requirements.txt /app/requirements.txt
|
| 17 |
+
RUN pip install --no-cache-dir -r /app/requirements.txt
|
| 18 |
|
| 19 |
+
# Copy app code (app.py, model/ if included, etc.)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
COPY . /app
|
| 21 |
|
| 22 |
+
# Default model path (override via Space Variable if needed)
|
| 23 |
+
ENV MODEL_PATH=/app/model/superkart_best_tuned_RandomForest.joblib
|
| 24 |
|
| 25 |
+
# Expose the port HF uses (default 7860)
|
| 26 |
EXPOSE 7860
|
|
|
|
|
|
|
| 27 |
ENV PORT=7860
|
| 28 |
|
| 29 |
+
# Serve with gunicorn, bound to $PORT
|
| 30 |
+
CMD ["sh", "-c", "gunicorn --bind 0.0.0.0:${PORT:-8000} app:app"]
|
|
|
|
| 31 |
|