Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Cleanup

f-trycuae88099aea417
diff --git a/libs/docker-xfce/Dockerfile b/libs/docker-xfce/Dockerfile
index d854c87661..02d48eb285 100644
--- a/libs/docker-xfce/Dockerfile
+++ b/libs/docker-xfce/Dockerfile
@@ -12,7 +12,7 @@ ENV DISPLAY=:1
ENV VNC_PORT=5901
ENV NOVNC_PORT=6901
ENV API_PORT=8000
-ENV VNC_RESOLUTION=1920x1080
+ENV VNC_RESOLUTION=1024x768
ENV VNC_COL_DEPTH=24
# Create user
@@ -47,7 +47,6 @@ RUN apt-get update && apt-get install -y \
socat \
xclip \
# Browser
- firefox \
wget \
software-properties-common \
# Build tools
@@ -66,16 +65,31 @@ RUN apt-get update && apt-get install -y \
# Remove power manager to avoid popup in container
RUN apt-get remove -y xfce4-power-manager xfce4-power-manager-data || true
+# Install Firefox from Mozilla PPA (snap-free) - inline to avoid script issues
+RUN apt-get update && \
+ add-apt-repository -y ppa:mozillateam/ppa && \
+ echo 'Package: *\nPin: release o=LP-PPA-mozillateam\nPin-Priority: 1001' > /etc/apt/preferences.d/mozilla-firefox && \
+ apt-get update && \
+ apt-get install -y firefox && \
+ echo 'pref("datareporting.policy.firstRunURL", "");\npref("datareporting.policy.dataSubmissionEnabled", false);\npref("datareporting.healthreport.service.enabled", false);\npref("datareporting.healthreport.uploadEnabled", false);\npref("trailhead.firstrun.branches", "nofirstrun-empty");\npref("browser.aboutwelcome.enabled", false);' > /usr/lib/firefox/browser/defaults/preferences/firefox.js && \
+ update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/firefox 100 && \
+ update-alternatives --install /usr/bin/gnome-www-browser gnome-www-browser /usr/bin/firefox 100 && \
+ rm -rf /var/lib/apt/lists/*
+
# Install noVNC
RUN git clone https://github.com/novnc/noVNC.git /opt/noVNC && \
git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify && \
ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html
+# Pre-create cache directory with correct ownership before pip install
+RUN mkdir -p /home/cua/.cache && \
+ chown -R cua:cua /home/cua/.cache
+
# Install computer-server
RUN pip3 install cua-computer-server
-# Firefox installation removed to speed up build
-# Can be added back later if needed
+# Fix any cache files created by pip
+RUN chown -R cua:cua /home/cua/.cache
# Copy startup scripts
COPY src/supervisor/ /etc/supervisor/conf.d/
@@ -94,10 +108,19 @@ RUN mkdir -p $HOME/.vnc && \
chmod 600 $HOME/.vnc/passwd
# Configure XFCE for first start
-RUN mkdir -p $HOME/.config/xfce4/xfconf/xfce-perchannel-xml
+RUN mkdir -p $HOME/.config/xfce4/xfconf/xfce-perchannel-xml $HOME/.config/xfce4 $HOME/.config/autostart
+
+# Copy XFCE config to disable browser launching and welcome screens
+COPY --chown=cua:cua src/xfce-config/helpers.rc $HOME/.config/xfce4/helpers.rc
+COPY --chown=cua:cua src/xfce-config/xfce4-session.xml $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml
+
+# Disable panel plugins that might try to open browsers
+RUN echo "[Desktop Entry]\nHidden=true" > $HOME/.config/autostart/xfce4-tips-autostart.desktop && \
+ chown -R cua:cua $HOME/.config
-# Create storage and shared directories
-RUN mkdir -p $HOME/storage $HOME/shared
+# Create storage and shared directories, and Firefox cache directory
+RUN mkdir -p $HOME/storage $HOME/shared $HOME/.cache/dconf $HOME/.mozilla/firefox && \
+ chown -R cua:cua $HOME/storage $HOME/shared $HOME/.cache $HOME/.mozilla $HOME/.vnc
USER root
diff --git a/libs/docker-xfce/Dockerfile.slim b/libs/docker-xfce/Dockerfile.slim
deleted file mode 100644
index 51c2233d53..0000000000
--- a/libs/docker-xfce/Dockerfile.slim
+++ /dev/null
@@ -1,53 +0,0 @@
-# CUA Docker XFCE Container - Slim Version
-# Uses existing VNC base to reduce build time
-
-FROM dorowu/ubuntu-desktop-lxde-vnc:focal
-
-# Switch to root
-USER root
-
-# Set environment variables
-ENV HOME=/home/cua
-ENV DISPLAY=:1
-ENV API_PORT=8000
-
-# Create cua user
-RUN useradd -m -s /bin/bash -G sudo cua && \
- echo "cua:password" | chpasswd && \
- echo "cua ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
-
-# Install Python 3.11 and computer-server dependencies
-RUN apt-get update && apt-get install -y \
- software-properties-common \
- gnome-screenshot \
- wmctrl \
- ffmpeg \
- socat \
- xclip \
- && add-apt-repository ppa:deadsnakes/ppa \
- && apt-get update \
- && apt-get install -y python3.11 python3-pip \
- && rm -rf /var/lib/apt/lists/*
-
-# Install computer-server
-RUN pip3 install cua-computer-server
-
-# Copy startup scripts
-COPY src/scripts/start-computer-server.sh /usr/local/bin/
-RUN chmod +x /usr/local/bin/start-computer-server.sh
-
-# Create storage directories
-RUN mkdir -p /home/cua/storage /home/cua/shared && \
- chown -R cua:cua /home/cua
-
-# Expose ports (VNC on 6080, computer-server on 8000)
-EXPOSE 6080 8000
-
-# Create startup wrapper
-RUN echo '#!/bin/bash\n\
-/startup.sh &\n\
-sleep 5\n\
-su - cua -c "/usr/local/bin/start-computer-server.sh"' > /entrypoint.sh && \
- chmod +x /entrypoint.sh
-
-CMD ["/entrypoint.sh"]
diff --git a/libs/docker-xfce/src/scripts/resize-display.sh b/libs/docker-xfce/src/scripts/resize-display.sh
new file mode 100644
index 0000000000..ea663dceb0
--- /dev/null
+++ b/libs/docker-xfce/src/scripts/resize-display.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Dynamic display resolution script
+# Can be called to change the VNC display resolution
+
+RESOLUTION=${1:-1920x1080}
+
+# Wait for display to be ready
+for i in {1..10}; do
+ if DISPLAY=:1 xdpyinfo >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+
+# Change resolution using xrandr
+DISPLAY=:1 xrandr --output VNC-0 --mode "$RESOLUTION" 2>/dev/null || \
+DISPLAY=:1 xrandr --fb "$RESOLUTION" 2>/dev/null || \
+echo "Failed to set resolution to $RESOLUTION"
+
+echo "Display resolution set to: $RESOLUTION"
diff --git a/libs/docker-xfce/src/xfce-config/helpers.rc b/libs/docker-xfce/src/xfce-config/helpers.rc
new file mode 100644
index 0000000000..8fd42f69a7
--- /dev/null
+++ b/libs/docker-xfce/src/xfce-config/helpers.rc
@@ -0,0 +1,2 @@
+# XFCE preferred applications - disable browser to prevent error popups
+WebBrowser=
diff --git a/libs/docker-xfce/src/xfce-config/xfce4-session.xml b/libs/docker-xfce/src/xfce-config/xfce4-session.xml
new file mode 100644
index 0000000000..d7b834d913
--- /dev/null
+++ b/libs/docker-xfce/src/xfce-config/xfce4-session.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<channel name="xfce4-session" version="1.0">
+ <property name="general" type="empty">
+ <property name="FailsafeSessionName" type="string" value="Failsafe"/>
+ <property name="SessionName" type="string" value="Default"/>
+ <property name="SaveOnExit" type="bool" value="false"/>
+ </property>
+ <property name="sessions" type="empty">
+ <property name="Failsafe" type="empty">
+ <property name="IsFailsafe" type="bool" value="true"/>
+ <property name="Count" type="int" value="5"/>
+ <property name="Client0_Command" type="array">
+ <value type="string" value="xfwm4"/>
+ </property>
+ <property name="Client0_Priority" type="int" value="15"/>
+ <property name="Client0_PerScreen" type="bool" value="false"/>
+ <property name="Client1_Command" type="array">
+ <value type="string" value="xfce4-panel"/>
+ </property>
+ <property name="Client1_Priority" type="int" value="25"/>
+ <property name="Client1_PerScreen" type="bool" value="false"/>
+ <property name="Client2_Command" type="array">
+ <value type="string" value="xfdesktop"/>
+ </property>
+ <property name="Client2_Priority" type="int" value="35"/>
+ <property name="Client2_PerScreen" type="bool" value="false"/>
+ <property name="Client3_Command" type="array">
+ <value type="string" value="xfsettingsd"/>
+ </property>
+ <property name="Client3_Priority" type="int" value="10"/>
+ <property name="Client3_PerScreen" type="bool" value="false"/>
+ <property name="Client4_Command" type="array">
+ <value type="string" value="xfce4-notifyd"/>
+ </property>
+ <property name="Client4_Priority" type="int" value="20"/>
+ <property name="Client4_PerScreen" type="bool" value="false"/>
+ </property>
+ </property>
+ <property name="splash" type="empty">
+ <property name="Engine" type="string" value=""/>
+ </property>
+ <property name="compat" type="empty">
+ <property name="LaunchGNOME" type="bool" value="false"/>
+ </property>
+ <property name="shutdown" type="empty">
+ <property name="ShowSuspend" type="bool" value="false"/>
+ <property name="ShowHibernate" type="bool" value="false"/>
+ <property name="ShowHybridSleep" type="bool" value="false"/>
+ <property name="ShowSwitchUser" type="bool" value="false"/>
+ </property>
+</channel>