FROM python:3.9-slim # Install utilities RUN apt-get update && apt-get install -y \ wget \ gnupg \ unzip \ curl \ ca-certificates \ && rm -rf /var/lib/apt/lists/* # Add Google Chrome's GPG key securely (Replacing deprecated apt-key) RUN install -m 0755 -d /etc/apt/keyrings \ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /etc/apt/keyrings/google-chrome.gpg \ && echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list # Install Google Chrome RUN apt-get update && apt-get install -y google-chrome-stable \ && rm -rf /var/lib/apt/lists/* # Set up a new user named "user" with user ID 1000 RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app COPY --chown=user . $HOME/app RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir -r requirements.txt CMD ["python", "app.py"]