File size: 1,039 Bytes
b0a0339
9e28b68
502749c
 
 
b0a0339
502749c
 
 
 
 
 
9e28b68
 
 
11e364e
76338b1
9e28b68
 
 
502749c
11e364e
 
502749c
9e28b68
 
502749c
9e28b68
502749c
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
FROM python:3.10-slim

# ── 1. Install Python deps first (as root) so we can use playwright CLI ──
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt

# ── 2. Let Playwright install ALL required system libraries automatically ──
#    This is the official way β€” it knows exactly which libs are needed
#    and avoids the manual guesswork that caused missing libXfixes etc.
RUN playwright install-deps chromium

# ── 3. Create the mandatory HF user (UID 1000) ──
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONUNBUFFERED=1

WORKDIR $HOME/app

# ── 4. Install the Chromium browser binary as the non-root user ──
RUN playwright install chromium

# ── 5. Copy the application code ──
COPY --chown=user app.py .

# ── 6. Expose the Streamlit port and launch ──
EXPOSE 7860
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true"]