Bootstrap: docker
From: amd64/debian
Stage: spython-base

%post

# Set environment variables
DEBIAN_FRONTEND=noninteractive

# Update and install required packages
apt-get update && apt-get install -y \
x11-apps \
xfce4 \
xfce4-terminal \
xrdp \
sudo \
nano \
curl \
wget \
git \
build-essential \
cmake \
tcsh \
tcl \
tk \
libzip4 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Create a user
useradd -m -s /bin/bash docker && echo "docker:docker" | chpasswd && adduser docker sudo

# Allow RDP connections
echo 'docker ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

# Set up Xfce as the default session for RDP
echo xfce4-session > /home/docker/.xsession

# Expose the RDP port
# EXPOSE 3389

# Start the RDP server

%environment
export DEBIAN_FRONTEND=noninteractive
%runscript
exec /bin/bash /usr/sbin/xrdp -n "$@"
%startscript
exec /bin/bash /usr/sbin/xrdp -n "$@"
