FROM ubuntu:24.04
# FROM consol/debian-xfce-vnc:latest
# Switch to root user to install additional software
USER 0

RUN apt update
RUN apt install -yq yt-dlp libssl-dev \
  wget curl unzip \
  openssl \
  ca-certificates \
  fontconfig \
  fonts-dejavu \
  libxext6 \
  libxrender1 \
  libxtst6 \
  gnupg \
  supervisor \
  python3 python3-pip python3-venv\
  scrot python3-tk python3-dev \
  libx11-6 libx11-dev libxext-dev libxtst6 \
  libpng-dev libjpeg-dev libtiff-dev libfreetype6-dev \
  x11-xserver-utils \
  xserver-xorg \
  fluxbox \
  xvfb \
  gnome-screenshot \
  libsqlite3-dev sqlite3 sqlitebrowser \
  sudo \
  && apt-get clean

RUN python3 -m pip install --break-system-packages --no-cache-dir curl_cffi

# Google Chrome stable, required at /usr/bin/google-chrome by both browser
# fallback backends (chromiumoxide auto-detects it there; playwright.rs hardcodes
# the path). apt pulls in all of Chrome's runtime shared-lib deps automatically.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg \
  && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
  && apt update \
  && apt install -yq google-chrome-stable \
  && apt-get clean

USER 1000
