minimew commited on
Commit
f940645
·
verified ·
1 Parent(s): b578c4a

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -12
Dockerfile CHANGED
@@ -1,17 +1,19 @@
1
- # Pre-built image: PyTorch CPU + Transformers already installed (avoids ~190 MB torch download)
2
- FROM huggingface/transformers-pytorch-cpu:latest
3
 
4
  WORKDIR /app
5
 
6
- # Base image ships with old pip -- upgrade first so it can resolve modern packages
7
- RUN pip install --upgrade pip && \
8
- pip install --no-cache-dir \
9
- fastapi \
10
- "uvicorn[standard]" \
11
- pandas \
12
- sqlglot \
13
- python-multipart \
14
- huggingface_hub
 
 
 
15
 
16
  # App source
17
  COPY src/ src/
@@ -24,4 +26,4 @@ COPY spider_data/database/concert_singer/ spider_data/database/concert_singer/
24
  # HF Spaces requires port 7860
25
  EXPOSE 7860
26
 
27
- CMD ["python3", "-m", "uvicorn", "src.app.api:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.11-slim
 
2
 
3
  WORKDIR /app
4
 
5
+ ENV LANG=C.UTF-8
6
+ ENV LC_ALL=C.UTF-8
7
+
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ gcc g++ \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # CPU-only torch (~190 MB) -- cached after first successful build
13
+ RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
14
+
15
+ COPY requirements.txt .
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
 
18
  # App source
19
  COPY src/ src/
 
26
  # HF Spaces requires port 7860
27
  EXPOSE 7860
28
 
29
+ CMD ["python", "-m", "uvicorn", "src.app.api:app", "--host", "0.0.0.0", "--port", "7860"]