# Use the official Python image as a base image FROM python:3.9 # Install required system dependencies RUN apt-get update && apt-get install -y \ zlib1g-dev \ gconf-service \ libasound2 \ libatk1.0-0 \ libc6 \ libcairo2 \ libcups2 \ libdbus-1-3 \ libexpat1 \ libfontconfig1 \ libgcc1 \ libgconf-2-4 \ libgdk-pixbuf2.0-0 \ libglib2.0-0 \ libgtk-3-0 \ libnspr4 \ libpango-1.0-0 \ libpangocairo-1.0-0 \ libstdc++6 \ libx11-6 \ libx11-xcb1 \ libxcb1 \ libxcomposite1 \ libxcursor1 \ libxdamage1 \ libxext6 \ libxfixes3 \ libxi6 \ libxrandr2 \ libxrender1 \ libxss1 \ libxtst6 \ ca-certificates \ fonts-liberation \ libappindicator1 \ libnss3 \ lsb-release \ xdg-utils \ wget \ && rm -rf /var/lib/apt/lists/* # Pyppeteer RUN apt-get update && apt-get install -y \ apt-transport-https \ ca-certificates \ curl \ gnupg \ --no-install-recommends \ && curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \ && echo "deb [arch=amd64] https://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 \ --no-install-recommends # It won't run from the root user. RUN groupadd chrome && useradd -g chrome -s /bin/bash -G audio,video chrome \ && mkdir -p /home/chrome && chown -R chrome:chrome /home/chrome # Set the working directory in the container WORKDIR /app # Copy the current directory contents into the container at /app COPY . /app # Install any needed dependencies specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Expose the port that Gunicorn will listen on EXPOSE 8000 # Define the command to run the application using Gunicorn CMD ["gunicorn", "app:app", "-b", "0.0.0.0:8000"]