File size: 997 Bytes
361629c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    curl \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Install uv for fast dependency management
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/

# Copy requirements first for better caching
COPY requirements.txt .
COPY pyproject.toml .

# Install dependencies
RUN uv pip install --system -r requirements.txt
RUN uv pip install --system -e .

# Copy the rest of the application
COPY . .

# Install Playwright browsers
RUN playwright install chromium
RUN playwright install-deps chromium

# Create non-root user
RUN useradd -m -u 1000 user && \
    chown -R user:user /app

USER user

# Expose port
EXPOSE 7860

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright

# Start the FastAPI server with Gradio UI
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]