sheikh987 commited on
Commit
b9eda33
·
verified ·
1 Parent(s): f738f4e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -10
Dockerfile CHANGED
@@ -1,17 +1,22 @@
1
- # Use a lightweight Python image
2
  FROM python:3.10-slim
3
 
4
- # Set work directory
5
  WORKDIR /app
6
 
7
- # Copy files
8
- COPY . .
9
 
10
- # Install dependencies
11
- RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Expose port
14
- EXPOSE 7860
15
 
16
- # Run the FastAPI app with Uvicorn
17
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
1
  FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
 
5
+ # Set the HuggingFace Transformers cache directory
6
+ ENV TRANSFORMERS_CACHE=/app/cache
7
 
8
+ # Create the cache directory and ensure it's writable
9
+ RUN mkdir -p /app/cache && chmod -R 777 /app/cache
10
 
11
+ # Install system dependencies
12
+ RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Copy files and install dependencies
15
+ COPY requirements.txt .
16
+ RUN pip install --upgrade pip && pip install -r requirements.txt
17
+
18
+ # Copy app code
19
+ COPY main.py .
20
+
21
+ # Run the FastAPI app
22
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]