sheltonmaharesh commited on
Commit
f58ef1b
·
verified ·
1 Parent(s): 64c96d4

Deploy backend Flask app

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -10
Dockerfile CHANGED
@@ -1,18 +1,19 @@
1
- # Use Python base image
2
- FROM python:3.10-slim
3
 
4
- # Set working directory
5
  WORKDIR /app
6
 
7
- # Copy all files into the container
8
- COPY . /app
9
 
10
- # Install dependencies
11
- RUN pip install --upgrade pip && \
12
- pip install -r requirements.txt
13
 
14
  # Expose port for Streamlit
15
  EXPOSE 7860
16
 
17
- # Run Streamlit app.
18
- CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
 
 
 
1
+ FROM python:3.9-slim
 
2
 
3
+ # Set the working directory inside the container
4
  WORKDIR /app
5
 
6
+ # Copy all files from the current directory to the container's working directory
7
+ COPY . .
8
 
9
+ # Install dependencies from the requirements file without using cache to reduce image size
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
11
 
12
  # Expose port for Streamlit
13
  EXPOSE 7860
14
 
15
+ # Define the command to start the application using Gunicorn with 4 worker processes
16
+ # - `-w 4`: Uses 4 worker processes for handling requests
17
+ # - `-b 0.0.0.0:7860`: Binds the server to port 7860 on all network interfaces
18
+ # - `app:app`: Runs the Flask app (assuming `app.py` contains the Flask instance named `app`)
19
+ CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:bot_detector_api"]