| FROM python:3.10-slim
|
|
|
| WORKDIR /code
|
|
|
|
|
| RUN apt-get update && apt-get install -y \
|
| wget \
|
| gnupg \
|
| xvfb \
|
| libgbm1 \
|
| libnss3 \
|
| libnspr4 \
|
| libxss1 \
|
| libasound2 \
|
| libatk1.0-0 \
|
| libatk-bridge2.0-0 \
|
| libdrm2 \
|
| libgtk-3-0 \
|
| libxkbcommon0 \
|
| libxcomposite1 \
|
| libxdamage1 \
|
| libxfixes3 \
|
| libxrandr2 \
|
| libpango-1.0-0 \
|
| libcairo2 \
|
| && mkdir -p /etc/apt/sources.list.d \
|
| && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google.gpg \
|
| && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list \
|
| && apt-get update \
|
| && apt-get install -y google-chrome-stable \
|
| && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
| RUN mkdir -p /.crawl4ai && chmod 777 /.crawl4ai
|
|
|
|
|
| RUN useradd -m myuser
|
| USER myuser
|
|
|
|
|
| COPY requirements.txt .
|
| RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
| RUN pip install --user playwright && \
|
| python -m playwright install chromium
|
|
|
|
|
| COPY app.py .
|
|
|
|
|
| CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |