Bhushan26 commited on
Commit
ff9e6c4
1 Parent(s): 1d9af2a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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 ./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,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
- # Set the command to run the application using Gunicorn
17
- # Increase the timeout to 600 seconds (10 minutes) and use 4 workers
18
- CMD ["gunicorn", "--timeout", "600", "-w", "4", "-b", "0.0.0.0:7860", "main:app"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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"]