Rajkhanke007 commited on
Commit
2f44a2c
·
verified ·
1 Parent(s): 27b2b3b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -5
Dockerfile CHANGED
@@ -4,14 +4,18 @@ FROM python:3.9-slim
4
  # Set the working directory
5
  WORKDIR /app
6
 
7
- # Copy the application files to the container
8
- COPY . /app
 
 
 
 
9
 
10
- # Install Python dependencies
11
- RUN pip install --no-cache-dir -r requirements.txt
12
 
13
  # Expose the Flask port (Hugging Face Spaces uses port 7860 by default)
14
  EXPOSE 7860
15
 
16
  # Command to run the Flask app
17
- CMD ["python", "app.py"]
 
4
  # Set the working directory
5
  WORKDIR /app
6
 
7
+ # Copy only requirements first to leverage Docker caching
8
+ COPY requirements.txt /app/
9
+
10
+ # Install dependencies before copying the full application
11
+ RUN pip install --no-cache-dir --upgrade pip \
12
+ && pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Copy the rest of the application files
15
+ COPY . /app
16
 
17
  # Expose the Flask port (Hugging Face Spaces uses port 7860 by default)
18
  EXPOSE 7860
19
 
20
  # Command to run the Flask app
21
+ CMD ["python", "app.py"]