|
| 1 | +# Docker Setup for Useless-Agent |
| 2 | + |
| 3 | +This document explains how to build and run the useless-agent application using Docker. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Docker installed on your system |
| 8 | +- Docker Compose (optional, but recommended) |
| 9 | +- An API key for your preferred LLM provider (DeepSeek or Z.AI) |
| 10 | + |
| 11 | +## Building the Docker Image |
| 12 | + |
| 13 | +### Option 1: Using Docker Compose (Recommended) |
| 14 | + |
| 15 | +1. Update the `docker-compose.yml` file with your API key: |
| 16 | + ```yaml |
| 17 | + environment: |
| 18 | + - API_KEY=your_actual_api_key_here |
| 19 | + ``` |
| 20 | +
|
| 21 | +2. Build and run the container: |
| 22 | + ```bash |
| 23 | + docker compose up --build |
| 24 | + ``` |
| 25 | + |
| 26 | +### Option 2: Using Docker directly |
| 27 | + |
| 28 | +1. Build the image: |
| 29 | + ```bash |
| 30 | + docker build -t useless-agent . |
| 31 | + ``` |
| 32 | + |
| 33 | +2. Run the container: |
| 34 | + ```bash |
| 35 | + docker run -d \ |
| 36 | + --name useless-agent-server \ |
| 37 | + -p 8080:8080 \ |
| 38 | + -e PROVIDER=deepseek \ |
| 39 | + -e BASE_URL=https://api.deepseek.com/v1 \ |
| 40 | + -e API_KEY=your_actual_api_key_here \ |
| 41 | + -e MODEL=deepseek-chat \ |
| 42 | + -e IP=0.0.0.0 \ |
| 43 | + -e PORT=8080 \ |
| 44 | + -e DISPLAY=:1 \ |
| 45 | + useless-agent |
| 46 | + ``` |
| 47 | + |
| 48 | +## Configuration |
| 49 | + |
| 50 | +The container can be configured using the following environment variables: |
| 51 | + |
| 52 | +### LLM Provider Configuration |
| 53 | + |
| 54 | +- `PROVIDER`: The LLM provider to use (`deepseek` or `zai`) |
| 55 | +- `BASE_URL`: The API base URL for your provider |
| 56 | +- `API_KEY`: Your API key for the provider |
| 57 | +- `MODEL`: The model to use (e.g., `deepseek-chat`, `glm-4.5-air`) |
| 58 | + |
| 59 | +### Server Configuration |
| 60 | + |
| 61 | +- `IP`: The IP address to bind to (default: `0.0.0.0`) |
| 62 | +- `PORT`: The port to listen on (default: `8080`) |
| 63 | +- `DISPLAY`: The X11 display (default: `:1`) |
| 64 | + |
| 65 | +## Accessing the Application |
| 66 | + |
| 67 | +### Finding the Container IP |
| 68 | + |
| 69 | +To get the IP address of the running container: |
| 70 | + |
| 71 | +```bash |
| 72 | +# Method 1: Using docker inspect |
| 73 | +docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' useless-agent-server |
| 74 | + |
| 75 | +# Method 2: Using docker exec |
| 76 | +docker exec useless-agent-server hostname -I |
| 77 | + |
| 78 | +# Method 3: If running on Docker Desktop (Mac/Windows), use localhost |
| 79 | +# The container is accessible via localhost:8080 |
| 80 | +``` |
| 81 | + |
| 82 | +### Connecting to the Application |
| 83 | + |
| 84 | +1. Once the container is running, open `main.html` in your web browser |
| 85 | +2. Enter the IP address obtained from the commands above |
| 86 | + - If running Docker on Linux: Use the container IP from the commands above |
| 87 | + - If running Docker Desktop on Mac/Windows: Use `localhost` or `127.0.0.1` |
| 88 | +3. Click "Connect" to establish a connection |
| 89 | +4. Start giving tasks to the agent through the LLM Chat interface |
| 90 | + |
| 91 | +## Example Usage |
| 92 | + |
| 93 | +### Using DeepSeek |
| 94 | + |
| 95 | +```bash |
| 96 | +docker run -d \ |
| 97 | + --name useless-agent-server \ |
| 98 | + -p 8080:8080 \ |
| 99 | + -e PROVIDER=deepseek \ |
| 100 | + -e BASE_URL=https://api.deepseek.com/v1 \ |
| 101 | + -e API_KEY=your_deepseek_api_key \ |
| 102 | + -e MODEL=deepseek-chat \ |
| 103 | + useless-agent |
| 104 | +``` |
| 105 | + |
| 106 | +### Using Z.AI |
| 107 | + |
| 108 | +```bash |
| 109 | +docker run -d \ |
| 110 | + --name useless-agent-server \ |
| 111 | + -p 8080:8080 \ |
| 112 | + -e PROVIDER=zai \ |
| 113 | + -e BASE_URL=https://api.z.ai/api/paas/v4 \ |
| 114 | + -e API_KEY=your_zai_api_key \ |
| 115 | + -e MODEL=glm-4.5-air \ |
| 116 | + useless-agent |
| 117 | +``` |
| 118 | + |
| 119 | +## Troubleshooting |
| 120 | + |
| 121 | +### Viewing Logs |
| 122 | + |
| 123 | +To view the logs of the running container: |
| 124 | + |
| 125 | +```bash |
| 126 | +docker logs useless-agent-server |
| 127 | +``` |
| 128 | + |
| 129 | +Or with Docker Compose: |
| 130 | + |
| 131 | +```bash |
| 132 | +docker compose logs -f |
| 133 | +``` |
| 134 | + |
| 135 | +### Stopping the Container |
| 136 | + |
| 137 | +To stop the container: |
| 138 | + |
| 139 | +```bash |
| 140 | +docker stop useless-agent-server |
| 141 | +``` |
| 142 | + |
| 143 | +Or with Docker Compose: |
| 144 | + |
| 145 | +```bash |
| 146 | +docker compose down |
| 147 | +``` |
| 148 | + |
| 149 | +### Rebuilding the Image |
| 150 | + |
| 151 | +If you make changes to the source code, you'll need to rebuild the image: |
| 152 | + |
| 153 | +```bash |
| 154 | +docker compose build --no-cache |
| 155 | +``` |
| 156 | + |
| 157 | +Or with Docker: |
| 158 | + |
| 159 | +```bash |
| 160 | +docker build --no-cache -t useless-agent . |
| 161 | +``` |
| 162 | + |
| 163 | +## Notes |
| 164 | + |
| 165 | +- The container includes Xvfb (X Virtual Framebuffer) and XFCE4 desktop environment |
| 166 | +- Tesseract OCR is installed for text recognition capabilities |
| 167 | +- The application runs on port 8080 inside the container |
| 168 | +- The Go binary is compiled during the build process and installed to `/app/useless-agent` |
| 169 | +- The container uses a simple startup script to manage Xvfb and XFCE processes |
| 170 | +- No special privileges are required to run this container |
0 commit comments