File size: 1,279 Bytes
bc1e5af
605fe36
 
87d3007
bc1e5af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87d3007
 
 
 
bc1e5af
605fe36
 
 
 
 
 
 
 
 
 
bc1e5af
605fe36
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Use a Python base image (ensures compatibility)
FROM python:3.10-slim

# Install Playwright's system dependencies, ensuring correct package names for Debian Trixie/13
RUN apt-get update \
    && apt-get install -y \
        wget \
        procps \
        libnss3 \
        libxcomposite1 \
        libxrandr2 \
        libgbm-dev \
        libasound2 \
        libatk1.0-0 \
        libatk-bridge2.0-0 \
        libatspi2.0-0 \
        libgtk-3-0 \
        libfontconfig1 \
        libglib2.0-0 \
        # Add the recommended replacement for the obsolete package, if necessary.
        # Let's try running without the specific gdk-pixbuf package first, 
        # as often the other installed packages satisfy the dependencies.
        # If it fails again, we will re-add 'libgdk-pixbuf-xlib-2.0-0'.
        --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /app

# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Crucial step: Download Playwright browsers
RUN playwright install chromium

# Copy your FastAPI app
COPY app.py .

# Define the command to run your FastAPI application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]