# coder/desktop/image — the workspace image: Coder's desktop base with KDE
# Plasma and KasmVNC baked in, so a start does not spend minutes in apt (the
# root filesystem is not persisted; only /home/coder is).
#
#   docker build -t git.nic-oconnor.com/public/coder-desktop-kde:noble coder/desktop/image
#   docker push git.nic-oconnor.com/public/coder-desktop-kde:noble
#
# noble, not resolute: KasmVNC publishes no resolute package yet.
FROM codercom/enterprise-desktop:ubuntu-noble

ARG KASMVNC_VERSION=1.5.0

USER root
# kwin-x11 is only a Recommends of kde-plasma-desktop, so --no-install-recommends
# drops it and Plasma comes up with no window manager (no title bars).
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      kde-plasma-desktop kwin-x11 dolphin konsole kate plasma-nm breeze-gtk-theme \
      dbus-x11 libdatetime-perl \
 && curl -fsSL -o /tmp/kasmvnc.deb \
      "https://github.com/kasmtech/KasmVNC/releases/download/v${KASMVNC_VERSION}/kasmvncserver_noble_${KASMVNC_VERSION}_amd64.deb" \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends /tmp/kasmvnc.deb \
 && rm -f /tmp/kasmvnc.deb /home/coder/.xsessionrc \
 && rm -rf /var/lib/apt/lists/*

# KasmVNC's `-select-de kde` (what the Coder kasmvnc module runs) looks for a
# `startkde` binary, which Plasma 5.20+ renamed to startplasma-x11.
RUN ln -s /usr/bin/startplasma-x11 /usr/local/bin/startkde

# No GPU in the pod: software compositing over VNC only adds lag. Users can
# still turn it on in System Settings (~/.config/kwinrc overrides this).
RUN printf '[Compositing]\nEnabled=false\n' > /etc/xdg/kwinrc

USER coder
