File size: 1,915 Bytes
ed0a3fa
 
118a4bf
ed0a3fa
118a4bf
 
 
 
 
 
 
 
 
 
 
 
ed0a3fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118a4bf
ed0a3fa
 
 
 
 
 
118a4bf
 
ed0a3fa
 
118a4bf
ed0a3fa
118a4bf
 
ed0a3fa
 
 
118a4bf
ed0a3fa
 
118a4bf
ed0a3fa
 
 
 
 
118a4bf
 
 
 
ed0a3fa
118a4bf
 
 
 
 
 
ed0a3fa
118a4bf
 
ed0a3fa
118a4bf
ed0a3fa
 
 
 
118a4bf
ed0a3fa
 
118a4bf
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
FROM huggingface/transformers-pytorch-gpu:latest

# Install VNC, desktop environment, and dependencies
RUN apt-get update && apt-get install -y \
    # Desktop environment
    xfce4 \
    xfce4-terminal \
    xorg \
    # VNC server and web client
    tigervnc-standalone-server \
    novnc \
    websockify \
    # Browser and automation tools
    firefox-esr \
    chromium-browser \
    # Required dependencies
    libgtk-3-0 \
    libx11-6 \
    libxext6 \
    libxrender1 \
    libxtst6 \
    libxrandr2 \
    libasound2 \
    libpangocairo-1.0-0 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libdrm2 \
    libxkbcommon0 \
    libxcomposite1 \
    libxdamage1 \
    libgbm1 \
    libxss1 \
    # Development tools
    wget \
    gnupg \
    unzip \
    curl \
    build-essential \
    python3-dev \
    # Python dependencies for automation
    python3-pip \
    && rm -rf /var/lib/apt/lists/*

# Set environment variables
ENV DISPLAY=:99
ENV VNC_PORT=5901
ENV VNC_PASSWORD=computer-agent
ENV PYTHONPATH=/workspace

# Create necessary directories
RUN mkdir -p /workspace /tmp/runtime-root /root/.vnc

# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Install Playwright browsers
RUN playwright install chromium

# Configure VNC server
RUN echo "$VNC_PASSWORD" | vncpasswd -f > /root/.vnc/passwd && \
    chmod 600 /root/.vnc/passwd

# Copy application files
COPY computer_agent.py .
COPY start_vnc.sh .
COPY xstartup .

# Make startup script executable
RUN chmod +x start_vnc.sh && chmod +x xstartup

# Expose ports
EXPOSE 7860 5901

# Set environment variables for Gradio
ENV GRADIO_SERVER_PORT=7860
ENV GRADIO_SERVER_NAME=0.0.0.0

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
    CMD curl -f http://localhost:7860/ || exit 1

# Start VNC server and Gradio interface
CMD ["./start_vnc.sh"]