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.

Fix Docker XFCE container build and VNC startup

f-trycua05c3356f1919
diff --git a/libs/docker-xfce/Dockerfile b/libs/docker-xfce/Dockerfile
index 94326ae27d..d5459f31e5 100644
--- a/libs/docker-xfce/Dockerfile
+++ b/libs/docker-xfce/Dockerfile
@@ -38,7 +38,6 @@ RUN apt-get update && apt-get install -y \
net-tools \
supervisor \
# Computer-server dependencies
- python3.11 \
python3-tk \
python3-dev \
gnome-screenshot \
@@ -62,12 +61,6 @@ RUN apt-get update && apt-get install -y \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
-# Install Python 3.11
-RUN add-apt-repository ppa:deadsnakes/ppa && \
- apt-get update && \
- apt-get install -y python3.11 python3.11-distutils && \
- 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 && \
@@ -84,8 +77,8 @@ RUN add-apt-repository -y ppa:mozillateam/ppa && \
rm -rf /var/lib/apt/lists/*
# Configure Firefox defaults
-RUN mkdir -p /etc/firefox/syspref.js && \
- echo 'pref("datareporting.policy.firstRunURL", "");' >> /etc/firefox/syspref.js && \
+RUN mkdir -p /etc/firefox && \
+ echo 'pref("datareporting.policy.firstRunURL", "");' > /etc/firefox/syspref.js && \
echo 'pref("datareporting.policy.dataSubmissionEnabled", false);' >> /etc/firefox/syspref.js && \
echo 'pref("datareporting.healthreport.service.enabled", false);' >> /etc/firefox/syspref.js && \
echo 'pref("datareporting.healthreport.uploadEnabled", false);' >> /etc/firefox/syspref.js && \
diff --git a/libs/docker-xfce/Dockerfile.slim b/libs/docker-xfce/Dockerfile.slim
new file mode 100644
index 0000000000..51c2233d53
--- /dev/null
+++ b/libs/docker-xfce/Dockerfile.slim
@@ -0,0 +1,53 @@
+# 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/start-vnc.sh b/libs/docker-xfce/src/scripts/start-vnc.sh
index 1cbba98f53..f77afef084 100644
--- a/libs/docker-xfce/src/scripts/start-vnc.sh
+++ b/libs/docker-xfce/src/scripts/start-vnc.sh
@@ -10,13 +10,14 @@ vncserver :1 \
-depth ${VNC_COL_DEPTH:-24} \
-rfbport ${VNC_PORT:-5901} \
-localhost no \
- -SecurityTypes None \
+ -SecurityTypes VncAuth \
-AlwaysShared \
-AcceptPointerEvents \
-AcceptKeyEvents \
-AcceptCutText \
-SendCutText \
- -xstartup /usr/local/bin/xstartup.sh
+ -xstartup /usr/local/bin/xstartup.sh \
+ --I-KNOW-THIS-IS-INSECURE
# Keep the process running
tail -f /home/cua/.vnc/*.log