Deep8591 commited on
Commit
1123987
·
verified ·
1 Parent(s): d5fa99a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -1
Dockerfile CHANGED
@@ -1,13 +1,23 @@
 
1
  FROM python:3.10
2
 
 
3
  WORKDIR /app
4
 
 
5
  COPY requirements.txt .
6
 
 
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
 
 
 
 
9
  COPY . .
10
 
 
11
  EXPOSE 7860
12
 
13
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ # Use official Python 3.10 base image
2
  FROM python:3.10
3
 
4
+ # Set the working directory in the container
5
  WORKDIR /app
6
 
7
+ # Copy the requirements file into the container
8
  COPY requirements.txt .
9
 
10
+ # Install dependencies without using cache to reduce image size
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Ensure a writable cache directory for Hugging Face models
14
+ ENV TRANSFORMERS_CACHE="/app/models_cache"
15
+
16
+ # Copy the application code into the container
17
  COPY . .
18
 
19
+ # Expose the application port
20
  EXPOSE 7860
21
 
22
+ # Command to run the FastAPI application with Uvicorn
23
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]