tejashsr commited on
Commit
e39f0e1
·
verified ·
1 Parent(s): 719d58d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -13
Dockerfile CHANGED
@@ -1,22 +1,24 @@
 
1
 
2
- FROM python:3.9
3
 
4
- WORKDIR /code
 
5
 
6
- # Copy requirements
7
- COPY ./requirements.txt /code/requirements.txt
 
8
 
9
- # Install dependencies
10
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
-
12
- # Download Spacy model during build
13
  RUN python -m spacy download en_core_web_sm
14
 
15
- # Copy app code
16
  COPY . .
17
 
18
- # Create cache dir for models
19
- RUN mkdir -p /opt && chmod 777 /opt
 
 
20
 
21
- # Run FastAPI
22
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.9-slim
2
 
3
+ WORKDIR /app
4
 
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
7
 
8
+ # Install Python libraries
9
+ COPY requirements.txt .
10
+ RUN pip install --no-cache-dir -r requirements.txt
11
 
12
+ # Download Spacy model during build (CRITICAL FOR SPEED)
 
 
 
13
  RUN python -m spacy download en_core_web_sm
14
 
15
+ # Copy App Code
16
  COPY . .
17
 
18
+ # Create cache directory with permissions
19
+ RUN mkdir -p /app/cache && chmod 777 /app/cache
20
+ ENV TRANSFORMERS_CACHE=/app/cache
21
+ ENV SENTENCE_TRANSFORMERS_HOME=/app/cache
22
 
23
+ # Start Server
24
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]