Prajith04 commited on
Commit
70c4bf5
·
verified ·
1 Parent(s): 0df7243

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -12
Dockerfile CHANGED
@@ -1,27 +1,27 @@
1
- # Base image with Python
2
  FROM python:3.10-slim
3
 
4
- # Install system dependencies
5
- RUN apt-get update && apt-get install -y \
6
- git \
7
- curl \
8
- && rm -rf /var/lib/apt/lists/*
9
 
10
- # Set work directory
11
  WORKDIR /app
12
 
13
- # Copy application files
 
 
 
 
14
  COPY . /app
15
 
16
- # Install Python dependencies
17
  RUN pip install --no-cache-dir --upgrade pip
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
- # Download SentenceTransformer model (caches on build)
21
  RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
22
 
23
- # Expose the app on port 7860 for Hugging Face Spaces
24
  ENV PORT 7860
25
 
26
- # Start FastAPI with uvicorn
27
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  FROM python:3.10-slim
2
 
3
+ # Install dependencies
4
+ RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
 
 
 
5
 
6
+ # Set working directory
7
  WORKDIR /app
8
 
9
+ # Create a local cache dir for HuggingFace models
10
+ ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
11
+ ENV HF_HOME=/app/.cache/huggingface
12
+
13
+ # Copy source files
14
  COPY . /app
15
 
16
+ # Install Python packages
17
  RUN pip install --no-cache-dir --upgrade pip
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
+ # Preload model into cache
21
  RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
22
 
23
+ # Expose port for Hugging Face Spaces
24
  ENV PORT 7860
25
 
26
+ # Launch FastAPI with Uvicorn
27
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]