OsamaBinLikhon commited on
Commit
118a4bf
·
verified ·
1 Parent(s): 1593e7a

Enhancement: Add VNC desktop environment integration

Browse files
Files changed (1) hide show
  1. Dockerfile +37 -21
Dockerfile CHANGED
@@ -1,8 +1,19 @@
1
  FROM huggingface/transformers-pytorch-gpu:latest
2
 
3
- # Install system dependencies for GUI and browser automation
4
  RUN apt-get update && apt-get install -y \
5
- # GUI and display libraries
 
 
 
 
 
 
 
 
 
 
 
6
  libgtk-3-0 \
7
  libx11-6 \
8
  libxext6 \
@@ -20,50 +31,55 @@ RUN apt-get update && apt-get install -y \
20
  libxdamage1 \
21
  libgbm1 \
22
  libxss1 \
23
- # Browser dependencies
24
  wget \
25
  gnupg \
26
  unzip \
27
  curl \
28
- # Development tools
29
  build-essential \
30
  python3-dev \
 
 
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
- # Set environment variables for GUI
34
  ENV DISPLAY=:99
35
- ENV QT_X11_NO_MITSHM=1
36
- ENV XDG_RUNTIME_DIR=/tmp/runtime-root
37
  ENV PYTHONPATH=/workspace
38
 
39
  # Create necessary directories
40
- RUN mkdir -p /workspace /tmp/runtime-root
41
-
42
- # Set working directory
43
- WORKDIR /workspace
44
-
45
- # Copy requirements first for better caching
46
- COPY requirements.txt .
47
 
48
  # Install Python dependencies
 
49
  RUN pip install --no-cache-dir -r requirements.txt
50
 
51
  # Install Playwright browsers
52
  RUN playwright install chromium
53
 
 
 
 
 
54
  # Copy application files
55
- COPY . .
 
 
 
 
 
56
 
57
- # Expose port for Gradio
58
- EXPOSE 7860
59
 
60
- # Set environment variable for Gradio
61
  ENV GRADIO_SERVER_PORT=7860
62
  ENV GRADIO_SERVER_NAME=0.0.0.0
63
 
64
  # Health check
65
- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
66
  CMD curl -f http://localhost:7860/ || exit 1
67
 
68
- # Run the application
69
- CMD ["python", "computer_agent.py"]
 
1
  FROM huggingface/transformers-pytorch-gpu:latest
2
 
3
+ # Install VNC, desktop environment, and dependencies
4
  RUN apt-get update && apt-get install -y \
5
+ # Desktop environment
6
+ xfce4 \
7
+ xfce4-terminal \
8
+ xorg \
9
+ # VNC server and web client
10
+ tigervnc-standalone-server \
11
+ novnc \
12
+ websockify \
13
+ # Browser and automation tools
14
+ firefox-esr \
15
+ chromium-browser \
16
+ # Required dependencies
17
  libgtk-3-0 \
18
  libx11-6 \
19
  libxext6 \
 
31
  libxdamage1 \
32
  libgbm1 \
33
  libxss1 \
34
+ # Development tools
35
  wget \
36
  gnupg \
37
  unzip \
38
  curl \
 
39
  build-essential \
40
  python3-dev \
41
+ # Python dependencies for automation
42
+ python3-pip \
43
  && rm -rf /var/lib/apt/lists/*
44
 
45
+ # Set environment variables
46
  ENV DISPLAY=:99
47
+ ENV VNC_PORT=5901
48
+ ENV VNC_PASSWORD=computer-agent
49
  ENV PYTHONPATH=/workspace
50
 
51
  # Create necessary directories
52
+ RUN mkdir -p /workspace /tmp/runtime-root /root/.vnc
 
 
 
 
 
 
53
 
54
  # Install Python dependencies
55
+ COPY requirements.txt .
56
  RUN pip install --no-cache-dir -r requirements.txt
57
 
58
  # Install Playwright browsers
59
  RUN playwright install chromium
60
 
61
+ # Configure VNC server
62
+ RUN echo "$VNC_PASSWORD" | vncpasswd -f > /root/.vnc/passwd && \
63
+ chmod 600 /root/.vnc/passwd
64
+
65
  # Copy application files
66
+ COPY computer_agent.py .
67
+ COPY start_vnc.sh .
68
+ COPY xstartup .
69
+
70
+ # Make startup script executable
71
+ RUN chmod +x start_vnc.sh && chmod +x xstartup
72
 
73
+ # Expose ports
74
+ EXPOSE 7860 5901
75
 
76
+ # Set environment variables for Gradio
77
  ENV GRADIO_SERVER_PORT=7860
78
  ENV GRADIO_SERVER_NAME=0.0.0.0
79
 
80
  # Health check
81
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
82
  CMD curl -f http://localhost:7860/ || exit 1
83
 
84
+ # Start VNC server and Gradio interface
85
+ CMD ["./start_vnc.sh"]