FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
    xfce4 \
    xfce4-goodies \
    xrdp \
    xvfb \
    xdotool \
    imagemagick \
    x11-apps \
    sudo \
    software-properties-common \
    firefox-esr \
    && apt-get remove -y light-locker xfce4-screensaver xfce4-power-manager || true \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash myuser && echo "myuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

COPY entrypoint.sh /home/myuser/entrypoint.sh
RUN chmod +x /home/myuser/entrypoint.sh && chown myuser:myuser /home/myuser/entrypoint.sh

USER myuser
WORKDIR /home/myuser

EXPOSE 5900

CMD ["/home/myuser/entrypoint.sh"]