yukee1992 commited on
Commit
cc1df3d
·
verified ·
1 Parent(s): a3fa882

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -0
Dockerfile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile
2
+ FROM python:3.9-slim
3
+
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ curl \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Copy requirements first
12
+ COPY requirements.txt .
13
+ RUN pip install --no-cache-dir -r requirements.txt
14
+
15
+ # Pre-download models during build
16
+ RUN python -c "from transformers import pipeline; \
17
+ pipeline('text-generation', model='distilgpt2')"
18
+
19
+ # Copy app code
20
+ COPY app.py .
21
+
22
+ EXPOSE 7860
23
+ EXPOSE 8000
24
+
25
+ # Run with uvicorn
26
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]