FROM riscv64/ubuntu:23.04

ENV DEBIAN_FRONTEND noninteractive

WORKDIR /root

RUN apt update -qq && apt install -y --no-install-recommends \
    software-properties-common \
    apt-transport-https \
    ca-certificates \
    lsb-release \
    net-tools \
    dirmngr \
    gnupg \
    git \
    curl \
    wget \
    file \
    unzip \
    zip \
    vim \
    mc \
    && rm -rf /var/lib/apt/lists/*

# Install X11
RUN apt update -qq && apt install -y --no-install-recommends \
    xvfb \
    x11vnc \
    at-spi2-core \
    dbus-x11 \
    x11-utils \
    mwm \
    xterm \
    xfonts-base \
    xfonts-75dpi \
    xfonts-100dpi \
    x11-xserver-utils \
    && rm -rf /var/lib/apt/lists/*

# VNC server
RUN mkdir ~/.vnc
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
RUN echo "mwm &" > ~/.xinitrc
RUN echo "xsetroot -solid grey" >> ~/.xinitrc
RUN chmod +x ~/.xinitrc

EXPOSE 5900

CMD ["x11vnc", "-repeat", "-forever", "-usepw", "-create"]