saadkhi commited on
Commit
1eff878
·
verified ·
1 Parent(s): cc1250f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -6
Dockerfile CHANGED
@@ -1,17 +1,25 @@
1
- ENV HF_HOME=/app/cache
2
-
3
  FROM python:3.10
4
 
5
  WORKDIR /app
6
 
 
 
 
 
 
 
 
7
  COPY requirements.txt .
8
  RUN pip install --no-cache-dir -r requirements.txt
9
 
10
- # 👇 Pre-download model
11
  RUN python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; \
12
- AutoTokenizer.from_pretrained('TinyLlama/TinyLlama-1.1B-Chat-v1.0'); \
13
- AutoModelForCausalLM.from_pretrained('TinyLlama/TinyLlama-1.1B-Chat-v1.0')"
14
 
 
15
  COPY app.py .
16
 
17
- CMD ["python", "app.py"]
 
 
 
 
 
1
  FROM python:3.10
2
 
3
  WORKDIR /app
4
 
5
+ # System deps
6
+ RUN apt-get update && apt-get install -y \
7
+ git \
8
+ curl \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Install Python deps
12
  COPY requirements.txt .
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
15
+ # Pre-download model (IMPORTANT: avoids runtime network issues)
16
  RUN python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; \
17
+ AutoTokenizer.from_pretrained('distilgpt2'); \
18
+ AutoModelForCausalLM.from_pretrained('distilgpt2')"
19
 
20
+ # Copy app
21
  COPY app.py .
22
 
23
+ EXPOSE 7860
24
+
25
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]