Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +19 -5
Dockerfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
# Use the official Python image as a base
|
2 |
-
FROM python:3.9
|
3 |
|
4 |
# Set the working directory
|
5 |
WORKDIR /code
|
6 |
|
7 |
# Copy the requirements file into the container
|
8 |
-
COPY
|
9 |
|
10 |
# Install any needed packages specified in requirements.txt
|
11 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
@@ -13,6 +13,20 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
13 |
# Copy the rest of the application code into the container
|
14 |
COPY . .
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Use the official Python image as a base
|
2 |
+
FROM python:3.9 AS base
|
3 |
|
4 |
# Set the working directory
|
5 |
WORKDIR /code
|
6 |
|
7 |
# Copy the requirements file into the container
|
8 |
+
COPY requirements.txt /code/requirements.txt
|
9 |
|
10 |
# Install any needed packages specified in requirements.txt
|
11 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
|
13 |
# Copy the rest of the application code into the container
|
14 |
COPY . .
|
15 |
|
16 |
+
# Stage for running the Flask application with Gunicorn
|
17 |
+
FROM base AS app
|
18 |
+
|
19 |
+
# Expose port 5000 to the outside world
|
20 |
+
EXPOSE 5000
|
21 |
+
|
22 |
+
# Command to run the application using Gunicorn with a timeout of 10 minutes
|
23 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--timeout", "600", "app:app"]
|
24 |
+
|
25 |
+
# Stage for running the Flask application in development mode
|
26 |
+
FROM base AS dev
|
27 |
+
|
28 |
+
# Expose port 5000 to the outside world
|
29 |
+
EXPOSE 5000
|
30 |
+
|
31 |
+
# Command to run the application using Flask's built-in server
|
32 |
+
CMD ["python", "app.py"]
|