mirror of
https://github.com/unclecode/crawl4ai.git
synced 2026-01-07 16:00:57 +00:00
46 lines
1.5 KiB
Plaintext
46 lines
1.5 KiB
Plaintext
# Use an official Python runtime as a parent image
|
|
FROM python:3.10-slim
|
|
# In case you had some weird issues, try this Image
|
|
# FROM python:3.10-slim-bookworm as builder
|
|
|
|
# Set the working directory in the container
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy the current directory contents into the container at /usr/src/app
|
|
COPY . .
|
|
|
|
# Install dependencies for Chrome and ChromeDriver
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
wget \
|
|
xvfb \
|
|
unzip \
|
|
curl \
|
|
gnupg2 \
|
|
ca-certificates \
|
|
apt-transport-https \
|
|
software-properties-common \
|
|
&& mkdir -p /etc/apt/keyrings \
|
|
&& curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /etc/apt/keyrings/google-linux-signing-keyring.gpg \
|
|
&& echo 'deb [arch=amd64 signed-by=/etc/apt/keyrings/google-linux-signing-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list \
|
|
&& apt-get update \
|
|
&& apt-get install -y google-chrome-stable \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& apt-get install -y chromium-chromedriver
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
RUN pip install spacy torch torchvision torchaudio
|
|
|
|
# Set display port and dbus env to avoid hanging
|
|
ENV DISPLAY=:99
|
|
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
|
|
|
|
# Make port 80 available to the world outside this container
|
|
EXPOSE 80
|
|
|
|
# Define environment variable
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
# Run uvicorn
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80", "--workers", "4"]
|