diff --git a/Dockerfile b/Dockerfile index 2d826ba..5883029 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,5 @@ -# docker run -e OPENROUTER_API_KEY="$OPENROUTER_API_KEY" -p 18790:18790 -it --volume="$PWD:/app" --workdir="/app" --entrypoint=/bin/sh clawlet FROM golang:1.26-alpine AS builder -RUN apk add --no-cache gcc musl-dev - WORKDIR /app COPY go.mod go.sum ./ @@ -10,19 +7,18 @@ RUN go mod download COPY . . -RUN CGO_ENABLED=1 go build -o clawlet ./cmd/clawlet +RUN CGO_ENABLED=0 go build -o /out/clawlet ./cmd/clawlet FROM alpine:latest RUN apk add --no-cache ca-certificates -WORKDIR /app - -COPY --from=builder /app/clawlet /usr/local/bin +COPY --from=builder /out/clawlet /usr/local/bin/clawlet -RUN clawlet onboard -RUN clawlet status +# Create config directory +RUN mkdir -p /root/.clawlet EXPOSE 18790 -ENTRYPOINT ["clawlet", "gateway"] +ENTRYPOINT ["clawlet"] +CMD ["status"] diff --git a/README.md b/README.md index d433eac..a581c20 100644 --- a/README.md +++ b/README.md @@ -35,35 +35,6 @@ clawlet status clawlet agent -m "What is 2+2?" ``` -## Docker - -Run clawlet using Docker or Docker Compose instead of installing locally. - -### Dockerfile - -The Dockerfile uses a multi-stage build: it compiles the Go application with CGO enabled (for sqlite-vec), then runs it in a minimal Alpine container. The container automatically runs `clawlet onboard` and `clawlet status` on first build, then starts the gateway. - -### Docker Compose - -```bash -docker-compose up --build -``` - -The gateway will be available at `http://localhost:18790`. - -### Plain Docker - -```bash -# Build the image -docker build -t clawlet . - -# Run the gateway -docker run -e OPENROUTER_API_KEY="$OPENROUTER_API_KEY" \ - -p 18790:18790 \ - -v "$PWD/clawlet.config.json:/root/.clawlet/config.json" \ - clawlet -``` - ## Configuration (`~/.clawlet/config.json`) Config file: `~/.clawlet/config.json` @@ -347,3 +318,24 @@ clawlet cron add --message "remind me" --at "2026-02-10T09:00:00Z" # Deliver to a chat (requires both --channel and --to) clawlet cron add --message "ping" --every 600 --channel slack --to U012345 ``` +## 🐳 Docker + +Build and run clawlet in a container: + +```bash +# Build the image +docker build -t clawlet . + +# Initialize config (first time only) +docker run -v ~/.clawlet:/root/.clawlet --rm clawlet onboard + +# Edit config on host to add API keys +vim ~/.clawlet/config.json + +# Run the gateway +docker run -v ~/.clawlet:/root/.clawlet -p 18790:18790 clawlet gateway + +# Or run a single command +docker run -v ~/.clawlet:/root/.clawlet --rm clawlet agent -m "Hello" +docker run -v ~/.clawlet:/root/.clawlet --rm clawlet status +``` diff --git a/clawlet.config.json b/clawlet.config.json deleted file mode 100644 index 06b80ea..0000000 --- a/clawlet.config.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "agents": { - "defaults": { - "model": "openrouter/google/gemini-3-flash-preview", - "maxTokens": 8192, - "temperature": 0.2, - "memoryWindow": 50, - "memorySearch": { - "enabled": false, - "provider": "openai", - "model": "text-embedding-3-small", - "remote": { - "baseURL": "https://api.openai.com/v1", - "apiKey": "", - "headers": {} - }, - "store": { - "path": "./memory-store", - "vector": { - "enabled": true - } - }, - "chunking": { - "tokens": 400, - "overlap": 80 - }, - "query": { - "maxResults": 6, - "minScore": 0.35, - "hybrid": { - "vectorWeight": 0.7, - "textWeight": 0.3, - "candidateMultiplier": 4 - } - }, - "cache": { - "enabled": true, - "maxEntries": 1000 - }, - "sync": { - "onSearch": true - } - } - } - }, - "tools": { - "restrictToWorkspace": true, - "exec": { - "timeoutSec": 60 - }, - "web": { - "braveApiKey": "" - } - }, - "cron": { - "enabled": true - }, - "heartbeat": { - "enabled": true, - "intervalSec": 1800 - }, - "gateway": { - "listen": "0.0.0.0:18790" - }, - "channels": { - "discord": { - "enabled": false, - "token": "", - "allowFrom": [ - "123456789" - ], - "gatewayURL": "wss://gateway.discord.gg/?v=10&encoding=json", - "intents": 37377 - }, - "slack": { - "enabled": false, - "allowFrom": [ - "U123ABC", - "U456DEF" - ], - "botToken": "xoxb-...", - "appToken": "xapp-...", - "groupPolicy": "mention", - "groupAllowFrom": [ - "C123CHAN" - ], - "dm": { - "enabled": true - } - }, - "telegram": { - "enabled": false, - "token": "", - "allowFrom": [ - "123456789" - ], - "baseURL": "https://api.telegram.org", - "pollTimeoutSec": 25, - "workers": 2 - }, - "whatsapp": { - "enabled": false, - "allowFrom": [ - "+1234567890" - ], - "sessionStorePath": "./whatsapp-session.db" - } - } -} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index dc5cf62..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -services: - clawlet: - build: - context: . - dockerfile: Dockerfile - container_name: clawlet - ports: - - "18790:18790" - environment: - # @see https://github.com/mosaxiv/clawlet?tab=readme-ov-file#supported-providers - # uses your shell ENV OR a `.env` - - OPENROUTER_API_KEY=${OPENROUTER_API_KEY} - volumes: - # copies the local config file to the container - - ./clawlet.config.json:/root/.clawlet/config.json - entrypoint: ["clawlet", "gateway"] - stdin_open: true - tty: true \ No newline at end of file