abdullahalioo commited on
Commit
7d0f4d3
·
verified ·
1 Parent(s): f6ba75c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -22
Dockerfile CHANGED
@@ -1,30 +1,13 @@
1
- FROM nvidia/cuda:12.1.1-base-ubuntu22.04
2
-
3
- # 1. Install system dependencies properly
4
- RUN apt-get update && apt-get install -y \
5
- python3.10 \
6
- python3-pip \
7
- python3.10-venv \
8
- git \
9
- && rm -rf /var/lib/apt/lists/*
10
-
11
- # 2. Create and activate virtual environment
12
- RUN python3.10 -m venv /opt/venv
13
- ENV PATH="/opt/venv/bin:$PATH"
14
-
15
- # 3. Set cache directories (writable locations)
16
- ENV TRANSFORMERS_CACHE=/app/model_cache \
17
- HF_HOME=/app/huggingface \
18
- XDG_CACHE_HOME=/app/cache
19
 
20
  WORKDIR /app
21
 
22
- # 4. Install requirements FIRST (better layer caching)
23
  COPY requirements.txt .
24
  RUN pip install --no-cache-dir -r requirements.txt
25
 
26
- # 5. Copy app code
27
  COPY . .
28
 
29
- # 6. Explicitly use the virtualenv's uvicorn
30
- CMD ["/opt/venv/bin/uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.9-slim
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # 1. Install dependencies
6
  COPY requirements.txt .
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
9
+
10
  COPY . .
11
 
12
+ # 5. Run FastAPI (HF Spaces expects port 7860)
13
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]