fmab777 commited on
Commit
cb5c3f1
·
verified ·
1 Parent(s): a1a607a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -43
Dockerfile CHANGED
@@ -4,61 +4,28 @@ FROM python:3.10-slim
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
- # *** CHANGED HOME DIRECTORY ***
8
- # Set the HOME environment variable to /tmp which should be writable.
9
- # This should influence where crawl4ai attempts to create its .crawl4ai directory.
10
- ENV HOME=/tmp
11
-
12
- # Install system dependencies required by Playwright/crawl4ai
13
- # Based on Playwright's recommendations for Debian/Ubuntu
14
- RUN apt-get update && apt-get install -y --no-install-recommends \
15
- # Base dependencies
16
- wget \
17
- gnupg \
18
- # Playwright browser dependencies (Chromium)
19
- libnss3 \
20
- libatk1.0-0 \
21
- libatk-bridge2.0-0 \
22
- libcups2 \
23
- libdrm2 \
24
- libdbus-1-3 \
25
- libxkbcommon0 \
26
- libatspi2.0-0 \
27
- libx11-6 \
28
- libxcomposite1 \
29
- libxdamage1 \
30
- libxext6 \
31
- libxfixes3 \
32
- libxrandr2 \
33
- libgbm1 \
34
- libpango-1.0-0 \
35
- libcairo2 \
36
- libasound2 \
37
- # Clean up
38
- && rm -rf /var/lib/apt/lists/*
39
-
40
  # Copy the requirements file into the container at /app
41
  COPY requirements.txt .
42
 
 
 
 
 
43
  # Install Python dependencies
44
  # Using --no-cache-dir reduces image size slightly
45
  RUN pip install --no-cache-dir -r requirements.txt
46
 
47
- # Run crawl4ai post-installation setup (installs browser binaries)
48
- # This should now download browsers relative to HOME=/tmp or its internal logic.
49
- RUN crawl4ai-setup
50
-
51
  # Copy the rest of the application code into the container at /app
52
  COPY . .
53
 
54
- # Make port specified by Hugging Face (usually 7860 or 8080) available
55
- # Use PORT environment variable, default to 7860 if not set
56
- ARG PORT=7860
57
- EXPOSE ${PORT}
58
 
59
  # Define environment variable to ensure Python output is sent straight to logs
60
  ENV PYTHONUNBUFFERED=1
61
 
62
  # Command to run the application using Gunicorn
63
- # Listen on all interfaces (0.0.0.0) on the port specified by HF
64
- CMD ["gunicorn", "--conf", "gunicorn.conf.py", "main:app"]
 
 
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"]