Chittrarasu commited on
Commit
8753236
·
1 Parent(s): 6d2a4c3
Files changed (1) hide show
  1. Dockerfile +25 -6
Dockerfile CHANGED
@@ -1,8 +1,27 @@
1
- FROM python:3.9-slim
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  WORKDIR /app
3
- COPY requirements.txt .
4
- RUN pip install --no-cache-dir -r requirements.txt
5
- RUN mkdir -p /app/cache && chmod -R 777 /app/cache
6
- COPY . .
 
7
  EXPOSE 7860
8
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
1
+ # Use an official Python image
2
+ FROM python:3.9
3
+
4
+ # Set environment variables for cache location
5
+ ENV HF_HOME="/app/cache"
6
+ ENV TRANSFORMERS_CACHE="/app/cache"
7
+
8
+ # Create the cache directory
9
+ RUN mkdir -p /app/cache
10
+
11
+ # Install required Python packages
12
+ RUN pip install --no-cache-dir sentence-transformers
13
+
14
+ # Pre-download the model during the image build process
15
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/clip-ViT-B-32-multilingual-v1')"
16
+
17
+ # Set working directory
18
  WORKDIR /app
19
+
20
+ # Copy application code
21
+ COPY . /app
22
+
23
+ # Expose port (if using FastAPI)
24
  EXPOSE 7860
25
+
26
+ # Command to run the application
27
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]