FROM python:3.9-slim # Install dependencies, including gnupg RUN apt-get update && apt-get install -y \ wget \ unzip \ curl \ xvfb \ libxi6 \ libgconf-2-4 \ gnupg && \ rm -rf /var/lib/apt/lists/* # Install Chrome RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \ 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 && \ rm -rf /var/lib/apt/lists/* # Install Chrome WebDriver RUN CHROME_DRIVER_VERSION=$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE) && \ wget -q -O /tmp/chromedriver.zip "https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip" && \ unzip /tmp/chromedriver.zip -d /usr/local/bin/ && \ rm /tmp/chromedriver.zip # Set display port to avoid crashes ENV DISPLAY=:99 # Install Python dependencies COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir -r /app/requirements.txt # Copy application files COPY . /app WORKDIR /app EXPOSE 7860 # Run the script CMD ["python", "main.py"]