# The exam's remote desktop: XFCE with a terminal and Firefox, served to the browser over noVNC.
# It is the "base" machine of a session - no kubeconfig here; every task says which host to ssh to.
FROM docker.io/library/debian:trixie-slim
ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8
RUN apt-get update \
 && apt-get install -y --no-install-recommends \
      xfce4 xfce4-terminal dbus-x11 elementary-xfce-icon-theme greybird-gtk-theme \
      fonts-dejavu fonts-liberation \
      tigervnc-standalone-server novnc websockify \
      firefox-esr mousepad xclip \
      openssh-client sudo vim nano less jq tmux curl wget bash-completion ca-certificates \
      procps iputils-ping dnsutils \
 && rm -rf /var/lib/apt/lists/*
COPY rootfs/ /
RUN useradd -m -s /bin/bash -u 1000 candidate \
 && echo 'candidate ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/candidate && chmod 440 /etc/sudoers.d/candidate \
 && install -d -o candidate -g candidate /home/candidate/.config/xfce4/xfconf/xfce-perchannel-xml \
 && install -m644 -o candidate -g candidate /etc/xdg/xfce4/panel/default.xml \
      /home/candidate/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml \
 && chmod +x /usr/local/bin/start-desktop
USER candidate
WORKDIR /home/candidate
EXPOSE 6080
ENTRYPOINT ["/usr/local/bin/start-desktop"]
