Update Dockerfile
Browse files- Dockerfile +7 -32
Dockerfile
CHANGED
|
@@ -4,41 +4,17 @@ FROM python:3.10-slim
|
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install system dependencies needed by Playwright browsers
|
| 8 |
-
# Reference: https://playwright.dev/docs/docker#python
|
| 9 |
-
# Using apt-get update before install and cleaning up reduces image size
|
| 10 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
-
libnss3 \
|
| 12 |
-
libnspr4 \
|
| 13 |
-
libdbus-glib-1-2 \
|
| 14 |
-
libatk1.0-0 \
|
| 15 |
-
libatk-bridge2.0-0 \
|
| 16 |
-
libcups2 \
|
| 17 |
-
libdrm2 \
|
| 18 |
-
libatspi2.0-0 \
|
| 19 |
-
libxcomposite1 \
|
| 20 |
-
libxdamage1 \
|
| 21 |
-
libxfixes3 \
|
| 22 |
-
libxrandr2 \
|
| 23 |
-
libgbm1 \
|
| 24 |
-
libpango-1.0-0 \
|
| 25 |
-
libcairo2 \
|
| 26 |
-
libasound2 \
|
| 27 |
-
libxshmfence1 \
|
| 28 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 29 |
-
|
| 30 |
# Copy the requirements file into the container at /app
|
| 31 |
COPY requirements.txt .
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
# Install Python dependencies
|
| 34 |
# Using --no-cache-dir reduces image size slightly
|
| 35 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 36 |
|
| 37 |
-
# Install Playwright browsers system-wide WITH dependencies
|
| 38 |
-
# This needs to happen *after* pip install crawl4ai (which depends on playwright)
|
| 39 |
-
# Using --with-deps installs necessary OS libraries if needed (though we added common ones above)
|
| 40 |
-
RUN playwright install --with-deps chromium firefox webkit
|
| 41 |
-
|
| 42 |
# Copy the rest of the application code into the container at /app
|
| 43 |
COPY . .
|
| 44 |
|
|
@@ -48,9 +24,8 @@ EXPOSE 7860
|
|
| 48 |
|
| 49 |
# Define environment variable to ensure Python output is sent straight to logs
|
| 50 |
ENV PYTHONUNBUFFERED=1
|
| 51 |
-
# Set PLAYWRIGHT_BROWSERS_PATH to use the system-wide install
|
| 52 |
-
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
|
| 53 |
|
| 54 |
# Command to run the application using Gunicorn
|
| 55 |
-
#
|
| 56 |
-
|
|
|
|
|
|
| 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 |
|
|
|
|
| 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"]
|