Update Dockerfile
Browse files- 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
|
| 8 |
-
COPY . /app
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 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"]
|