suppa09 commited on
Commit
3b98f5d
·
verified ·
1 Parent(s): 28d2a5b

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -18
Dockerfile CHANGED
@@ -1,29 +1,20 @@
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"]
 
 
1
+ FROM python:3.10-slim
 
 
 
 
 
 
 
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # System deps
6
  RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ git build-essential \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Install Python deps
11
  COPY requirements.txt .
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Copy app
15
  COPY app.py .
16
 
17
+ # HF Spaces expects port 7860
 
 
18
  EXPOSE 7860
19
+
20
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]