Spaces:
Sleeping
Sleeping
Deploy backend Flask app
Browse files- Dockerfile +11 -10
Dockerfile
CHANGED
|
@@ -1,18 +1,19 @@
|
|
| 1 |
-
|
| 2 |
-
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy all files
|
| 8 |
-
COPY .
|
| 9 |
|
| 10 |
-
# Install dependencies
|
| 11 |
-
RUN pip install --upgrade
|
| 12 |
-
pip install -r requirements.txt
|
| 13 |
|
| 14 |
# Expose port for Streamlit
|
| 15 |
EXPOSE 7860
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 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"]
|