File size: 1,003 Bytes
078cae9
bd2226d
 
078cae9
bd2226d
 
4fd964f
540d948
078cae9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4fd964f
 
540d948
 
078cae9
bd2226d
 
 
078cae9
 
 
 
 
 
 
bd2226d
 
078cae9
bd2226d
078cae9
 
4fd964f
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
42
43
44
45
46
47
48
# Use official Python slim image
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies including Playwright requirements
RUN apt-get update && apt-get install -y \
    curl \
    gnupg \
    ca-certificates \
    libnss3 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libx11-xcb1 \
    libxcomposite1 \
    libxdamage1 \
    libxrandr2 \
    libgbm1 \
    libpango-1.0-0 \
    libpangocairo-1.0-0 \
    libasound2 \
    fonts-liberation \
    libglib2.0-0 \
    libdrm2 \
    libxfixes3 \
    libxkbcommon0 \
    && rm -rf /var/lib/apt/lists/*

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

# Set Playwright browsers to a writable path
ENV PLAYWRIGHT_BROWSERS_PATH=/tmp/playwright-browsers

# Install Playwright browsers
RUN playwright install chromium

# Copy app files
COPY . .

# Expose port
EXPOSE 7860

# Run FastAPI
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]