fmab777 commited on
Commit
76be54d
·
verified ·
1 Parent(s): 252bda9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -31
Dockerfile CHANGED
@@ -1,31 +1,38 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.10-slim
3
-
4
- # Set the working directory in the container
5
- WORKDIR /app
6
-
7
- # Copy the requirements file into the container at /app
8
- COPY requirements.txt .
9
-
10
- # Install any needed system dependencies (if any - bs4, requests usually don't need much)
11
- # RUN apt-get update && apt-get install -y --no-install-recommends some-package && rm -rf /var/lib/apt/lists/*
12
- # For this bot, we likely don't need extra apt packages currently.
13
-
14
- # Install Python dependencies
15
- # Using --no-cache-dir reduces image size slightly
16
- RUN pip install --no-cache-dir -r requirements.txt
17
-
18
- # Copy the rest of the application code into the container at /app
19
- COPY . .
20
-
21
- # Make port 7860 available to the world outside this container
22
- # Hugging Face Spaces typically expect apps to run on port 7860
23
- EXPOSE 7860
24
-
25
- # Define environment variable to ensure Python output is sent straight to logs
26
- ENV PYTHONUNBUFFERED=1
27
-
28
- # Command to run the application using Gunicorn
29
- # It will run the Flask 'app' object found in the 'main' module (main.py)
30
- # Listen on all interfaces (0.0.0.0) on the port specified by HF (usually 7860)
31
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "main:app"]
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.10-slim
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Copy the requirements file into the container at /app
8
+ COPY requirements.txt .
9
+
10
+ # Install any needed system dependencies (if any - bs4, requests usually don't need much)
11
+ # RUN apt-get update && apt-get install -y --no-install-recommends some-package && rm -rf /var/lib/apt/lists/*
12
+ # For this bot, we likely don't need extra apt packages currently.
13
+
14
+ # Install Python dependencies
15
+ # Using --no-cache-dir reduces image size slightly
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Install crawl4ai dependencies (Playwright browsers)
19
+ # Needs to run *after* pip install and requires system dependencies installed by playwright itself
20
+ # Using --with-deps installs necessary browser dependencies like fonts, libs etc.
21
+ RUN crawl4ai-setup
22
+ RUN python -m playwright install --with-deps chromium
23
+
24
+ # Copy the rest of the application code into the container at /app
25
+ COPY . .
26
+
27
+ # Make port defined by PORT env var (default 7860) available
28
+ # Hugging Face Spaces typically expect apps to run on port 7860
29
+ EXPOSE ${PORT:-7860}
30
+
31
+ # Define environment variable to ensure Python output is sent straight to logs
32
+ ENV PYTHONUNBUFFERED=1
33
+
34
+ # Command to run the application using Gunicorn
35
+ # It will run the Starlette 'app' object found in the 'main' module (main.py)
36
+ # Listen on all interfaces (0.0.0.0) on the port specified by HF/env var (usually 7860)
37
+ # Using environment variable expansion for port binding
38
+ CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:${PORT:-7860}", "main:app"]