AnshulS commited on
Commit
6880adc
·
verified ·
1 Parent(s): 3ffdc36

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -10
Dockerfile CHANGED
@@ -1,17 +1,27 @@
1
- FROM python:3.10
 
2
 
3
- WORKDIR /app
4
- COPY . /app
 
 
5
 
 
 
 
 
 
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
8
- EXPOSE 7860
9
- ENV HF_HOME=/tmp
10
- ENV TRANSFORMERS_CACHE=/tmp
11
- ENV SENTENCE_TRANSFORMERS_HOME=/tmp
12
 
13
- # Pre-download the sentence-transformers model
14
- RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
 
15
 
 
 
16
 
17
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ # Use Python base image
2
+ FROM python:3.10-slim
3
 
4
+ # Set environment variables
5
+ ENV HF_HOME=/app/hf_cache
6
+ ENV TRANSFORMERS_CACHE=/app/hf_cache
7
+ ENV SENTENCE_TRANSFORMERS_HOME=/app/hf_cache
8
 
9
+ # Install system deps
10
+ RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Install Python deps
13
+ COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # Pre-download the model
17
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
 
 
18
 
19
+ # Copy app code
20
+ COPY . /app
21
+ WORKDIR /app
22
 
23
+ # Expose port
24
+ EXPOSE 7860
25
 
26
+ # Start the app
27
+ CMD ["python", "app.py"]