Spaces:
Running
Running
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"]
|