Skip to content

Instantly share code, notes, and snippets.

@jamesmurdza
Created April 2, 2025 09:13
Show Gist options
  • Select an option

  • Save jamesmurdza/7af3b94152f2b7bb1634886f1c4a47ee to your computer and use it in GitHub Desktop.

Select an option

Save jamesmurdza/7af3b94152f2b7bb1634886f1c4a47ee to your computer and use it in GitHub Desktop.
New Dockerfile
FROM ubuntu:22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive \
DEBIAN_PRIORITY=high \
PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1
# Basic system setup
# These are core dependencies needed by nearly all other components
# software-properties-common: Required for add-apt-repository
# build-essential: Needed for compiling various packages
RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y --no-install-recommends \
software-properties-common \
apt-transport-https \
curl \
wget \
git \
build-essential \
sudo \
locales \
util-linux \
net-tools \
netcat \
vim \
unzip && \
yes | unminimize
# Install X11 and desktop environment
# These packages provide the graphical environment and are required for any GUI applications
# xserver-xorg, xorg: Core X server components
# xfce4: The desktop environment that will host the applications
# x11vnc: Required for remote desktop access via noVNC
RUN apt-get update && \
apt-get install -y --no-install-recommends \
xserver-xorg \
xorg \
xvfb \
x11-utils \
x11-xserver-utils \
dbus-x11 \
xauth \
xterm \
xdotool \
xfce4 \
xfce4-goodies \
xubuntu-icon-theme \
mutter \
tint2 \
x11vnc \
scrot
# Install Python and development tools
# Python is required for:
# 1. noVNC's websockify component (converts VNC to WebSockets)
# 2. Any Python scripts you might run in the environment
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python-is-python3 \
python3-dev \
python3-pip \
python3-tk \
python3-xlib \
python3-jwt \
python3-oauthlib \
python3-lazr.restfulclient \
python3-launchpadlib \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
libncursesw5-dev \
xz-utils \
tk-dev \
libxml2-dev \
libxmlsec1-dev \
libffi-dev \
liblzma-dev
# Install Python packages
# mux_python, requests: Used for API communication
# numpy: Required by websockify for noVNC
RUN pip3 install mux_python requests numpy
# Install noVNC and websockify
# noVNC provides browser-based VNC access
# websockify (requires Python & numpy) translates WebSockets to VNC protocol
RUN git clone --branch e2b-desktop https://github.com/e2b-dev/noVNC.git /opt/noVNC && \
git clone --branch v0.12.0 https://github.com/novnc/websockify /opt/noVNC/utils/websockify && \
ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html
# Set default terminal
RUN sudo ln -sf /usr/bin/xfce4-terminal.wrapper /etc/alternatives/x-terminal-emulator
# Install common applications (placed last for easier updates)
# These user applications depend on X11 and desktop environment
# Mozilla PPA is required for Firefox installation
# Install common applications (placed last for easier updates)
RUN apt-get update && apt-get install -y gnupg && \
sudo add-apt-repository ppa:mozillateam/ppa && \
apt-get update && \
apt-get install -y --no-install-recommends \
libreoffice \
firefox-esr \
gnumeric \
x11-apps \
xpdf \
gedit \
xpaint \
galculator \
pcmanfm \
ffmpeg \
gnome-screenshot
# Copy configuration files
# 45-allow-colord.pkla: PolicyKit configuration for color management
# Xauthority: X11 authentication file (required for X11 security)
# wallpaper.png: Desktop background image for XFCE
COPY ./45-allow-colord.pkla /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
COPY ./Xauthority /home/user/.Xauthority
COPY ./wallpaper.png /usr/share/backgrounds/xfce/wallpaper.png
# Install VS Code (placed last for easier updates)
# Requires apt-transport-https and wget from the base system
# VS Code depends on X11 for its GUI
RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
add-apt-repository -y "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" && \
apt-get update -y && \
apt-get install -y code
# Configure VS Code
# Creates settings that:
# - Enable auto-save (requires VS Code installation)
# - Disable workspace trust prompts (improves usability in container)
RUN mkdir -p /home/user/.config/Code/User && \
echo '{"files.autoSave": "afterDelay", "files.autoSaveDelay": 200, "security.allowHttp": true, "security.workspace.trust.startupPrompt": "never", "security.workspace.trust.enabled": false, "security.workspace.trust.banner": "never", "security.workspace.trust.emptyWindow": false}' > /home/user/.config/Code/User/settings.json
# Clean up
# Reduces image size by removing package caches
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
@mishushakov
Copy link
Copy Markdown

fyi., we no longer need to include Mux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment