suppa09 commited on
Commit
f85fa70
·
verified ·
1 Parent(s): 3b4f829

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -4
Dockerfile CHANGED
@@ -1,22 +1,29 @@
1
- # HuggingFace Spaces Docker SDK — runs on port 7860
2
- # v16 — adds XGBoost + CatBoost + LightGBM. libgomp1 is required by all three.
3
  FROM python:3.11-slim
4
 
5
  ENV PYTHONUNBUFFERED=1 \
6
  PIP_NO_CACHE_DIR=1 \
7
  HF_HOME=/tmp/hf \
 
8
  TRANSFORMERS_CACHE=/tmp/hf \
 
 
9
  PORT=7860
10
 
11
  WORKDIR /app
12
 
 
13
  RUN apt-get update && apt-get install -y --no-install-recommends \
14
- build-essential git curl libgomp1 && rm -rf /var/lib/apt/lists/*
 
15
 
16
  COPY requirements.txt .
17
  RUN pip install --upgrade pip && pip install -r requirements.txt
18
 
19
  COPY app.py .
20
 
 
 
 
21
  EXPOSE 7860
22
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # HuggingFace Spaces Docker SDK — port 7860
 
2
  FROM python:3.11-slim
3
 
4
  ENV PYTHONUNBUFFERED=1 \
5
  PIP_NO_CACHE_DIR=1 \
6
  HF_HOME=/tmp/hf \
7
+ HF_HUB_CACHE=/tmp/hf \
8
  TRANSFORMERS_CACHE=/tmp/hf \
9
+ XDG_CACHE_HOME=/tmp/cache \
10
+ MPLCONFIGDIR=/tmp/mpl \
11
  PORT=7860
12
 
13
  WORKDIR /app
14
 
15
+ # libgomp1 is required by xgboost / lightgbm / catboost at runtime.
16
  RUN apt-get update && apt-get install -y --no-install-recommends \
17
+ build-essential curl libgomp1 \
18
+ && rm -rf /var/lib/apt/lists/*
19
 
20
  COPY requirements.txt .
21
  RUN pip install --upgrade pip && pip install -r requirements.txt
22
 
23
  COPY app.py .
24
 
25
+ # HF Spaces runs as a non-root user — cache dirs must be writable.
26
+ RUN mkdir -p /tmp/hf /tmp/cache /tmp/mpl && chmod -R 777 /tmp/hf /tmp/cache /tmp/mpl
27
+
28
  EXPOSE 7860
29
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]