x11-desktop / Dockerfile
3v324v23's picture
Cleanup: Remove duplicate mousepad and update README
81b3f80
FROM ubuntu:22.04
# Prevent interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
ENV DISPLAY=:1
ENV VNC_PORT=5901
ENV NO_VNC_PORT=6080
ENV VNC_PASSWORD=vncpassword
# Install system dependencies
RUN apt-get update && apt-get install -y \
# X11 and Desktop Environments
xfce4 \
xfce4-goodies \
xfce4-terminal \
lxqt \
mate-desktop-environment \
mate-terminal \
lightdm \
dbus-x11 \
openbox \
obconf \
# VNC Server
tigervnc-standalone-server \
tigervnc-common \
# noVNC for browser access
novnc \
websockify \
# Essential applications
gimp \
firefox \
libreoffice \
thunar \
mousepad \
# System utilities
wget \
curl \
git \
vim \
nano \
htop \
file \
unzip \
zip \
# Python for agent
python3 \
python3-pip \
python3-venv \
# Browser automation dependencies
xdotool \
scrot \
imagemagick \
wmctrl \
# Fonts
fonts-liberation \
fonts-dejavu \
# Clean up
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install openssl for SSL certificate generation
RUN apt-get update && apt-get install -y openssl && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Generate self-signed SSL certificate for WSS
RUN openssl req -x509 -newkey rsa:4096 -keyout /etc/ssl/private/selfsigned.key -out /etc/ssl/certs/selfsigned.crt -days 365 -nodes -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"
# Install Playwright browsers
RUN pip3 install --no-cache-dir playwright && \
playwright install firefox && \
playwright install-deps firefox
# Create user for VNC session
RUN useradd -m -s /bin/bash vncuser && \
mkdir -p /home/vncuser/.vnc && \
chown -R vncuser:vncuser /home/vncuser
# Set up VNC password
USER vncuser
RUN echo "${VNC_PASSWORD}" | vncpasswd -f > /home/vncuser/.vnc/passwd && \
chmod 600 /home/vncuser/.vnc/passwd
# Configure VNC startup with desktop environment selection
RUN echo '#!/bin/bash' > /home/vncuser/.vnc/xstartup && \
echo 'unset SESSION_MANAGER' >> /home/vncuser/.vnc/xstartup && \
echo 'unset DBUS_SESSION_BUS_ADDRESS' >> /home/vncuser/.vnc/xstartup && \
echo 'export XKL_XMODMAP_DISABLE=1' >> /home/vncuser/.vnc/xstartup && \
echo 'if [ "$DESKTOP_ENV" = "lxqt" ]; then' >> /home/vncuser/.vnc/xstartup && \
echo ' exec startlxqt' >> /home/vncuser/.vnc/xstartup && \
echo 'elif [ "$DESKTOP_ENV" = "mate" ]; then' >> /home/vncuser/.vnc/xstartup && \
echo ' exec mate-session' >> /home/vncuser/.vnc/xstartup && \
echo 'elif [ "$DESKTOP_ENV" = "openbox" ]; then' >> /home/vncuser/.vnc/xstartup && \
echo ' exec openbox-session' >> /home/vncuser/.vnc/xstartup && \
echo 'else' >> /home/vncuser/.vnc/xstartup && \
echo ' exec startxfce4' >> /home/vncuser/.vnc/xstartup && \
echo 'fi' >> /home/vncuser/.vnc/xstartup && \
chmod +x /home/vncuser/.vnc/xstartup
USER root
# Install Python dependencies for agent and Gradio app
COPY requirements.txt /tmp/requirements.txt
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt
# Copy application files
WORKDIR /app
COPY . /app
# Create necessary directories
RUN mkdir -p /app/scripts /app/agent /app/logs && \
chown -R vncuser:vncuser /app
# Expose ports
EXPOSE ${VNC_PORT} ${NO_VNC_PORT} 7860 8000
# Copy and set permissions for startup script
COPY scripts/start-desktop.sh /app/scripts/start-desktop.sh
RUN chmod +x /app/scripts/start-desktop.sh
# Start services
CMD ["/app/scripts/start-desktop.sh"]