keepalive / Dockerfile
datamk's picture
Upload 3 files
502749c verified
raw
history blame
1.04 kB
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"]