File size: 1,107 Bytes
ebc3038
 
9c27d7d
ebc3038
9c27d7d
 
 
 
 
ebc3038
 
 
9c27d7d
ebc3038
 
 
 
 
 
 
 
9c27d7d
 
 
ebc3038
9c27d7d
 
ebc3038
9c27d7d
 
ebc3038
9c27d7d
 
 
ebc3038
9c27d7d
 
ebc3038
9c27d7d
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
# 1. Use the specific Python version you requested
FROM python:3.11.9-slim

# 2. Install basic system tools
RUN apt-get update && apt-get install -y \
    wget \
    gnupg \
    && rm -rf /var/lib/apt/lists/*

# 3. Install Playwright python library temporarily as root
# We need this so we can run the 'install-deps' command next
RUN pip install playwright

# 4. CRITICAL STEP: Install the missing system browsers libraries
# This downloads all the linux dependencies (libglib, libnss, etc.)
# that caused your previous crash.
RUN playwright install-deps

# 5. Set up the Hugging Face user (Security Requirement)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# 6. Set working directory
WORKDIR $HOME/app

# 7. Copy your application files
COPY --chown=user . $HOME/app

# 8. Install your project dependencies (gradio, crawl4ai, etc.)
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# 9. Install the actual Chromium Browser binary
RUN playwright install chromium

# 10. Start the App
CMD ["python", "app.py"]