FROM python:3.11-slim # Create user with UID 1000 RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app # System dependencies (as root) USER root RUN apt-get update && apt-get install -y \ wget curl iputils-ping \ libglib2.0-0 libnss3 libnspr4 libdbus-1-3 \ libatk1.0-0 libatk-bridge2.0-0 libcups2 \ libdrm2 libxcb1 libxkbcommon0 libatspi2.0-0 \ libx11-6 libxcomposite1 libxdamage1 libxext6 \ libxfixes3 libxrandr2 libgbm1 libpango-1.0-0\ libcairo2 libasound2 \ && rm -rf /var/lib/apt/lists/* # Python deps COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Playwright browser RUN playwright install chromium # App code COPY --chown=user . . # Create dirs RUN mkdir -p screenshots recordings && chown -R user:user /app USER user EXPOSE 7860 CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]