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"]