Rizwan9 commited on
Commit
ce65a34
·
verified ·
1 Parent(s): 7c7e948

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -6
Dockerfile CHANGED
@@ -1,21 +1,22 @@
1
  FROM python:3.10-slim
2
 
3
- # Prevent buffering & control thread usage
4
  ENV PYTHONUNBUFFERED=1
 
5
  ENV OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 NUMEXPR_NUM_THREADS=1
 
 
6
 
7
- ARG BUILD_ID=10
8
  WORKDIR /app
9
 
10
- # Install dependencies
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
- # Copy app & model (make sure this filename matches your artifact)
15
  COPY app.py best_model_random_forest.joblib ./
16
  ENV MODEL_PATH=best_model_random_forest.joblib
17
 
18
  EXPOSE 7860
19
 
20
- # ✅ Use $PORT (Hugging Face default) instead of fixed 5000
21
- CMD ["sh", "-c", "gunicorn -w 2 -k gthread --threads 2 --timeout 120 -b 0.0.0.0:$PORT app:app"]
 
1
  FROM python:3.10-slim
2
 
 
3
  ENV PYTHONUNBUFFERED=1
4
+ # keep CPU tiny runners stable
5
  ENV OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 NUMEXPR_NUM_THREADS=1
6
+ # provide a default in case HF doesn't inject $PORT for any reason
7
+ ENV PORT=7860
8
 
9
+ ARG BUILD_ID=12
10
  WORKDIR /app
11
 
 
12
  COPY requirements.txt .
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
15
+ # match this filename to your actual artifact in the repo
16
  COPY app.py best_model_random_forest.joblib ./
17
  ENV MODEL_PATH=best_model_random_forest.joblib
18
 
19
  EXPOSE 7860
20
 
21
+ # ✅ run the Flask app; it reads PORT via os.getenv("PORT", "5000")
22
+ CMD ["python","app.py"]