FROM python:3.9-slim # Install Chrome and dependencies RUN apt-get update && apt-get install -y \ wget \ gnupg \ unzip \ curl \ xvfb \ libxi6 \ libgconf-2-4 \ default-jdk \ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' \ && apt-get update \ && apt-get install -y google-chrome-stable # Set up working directory WORKDIR /app # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the app COPY . . # Create a non-root user for Chrome RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]