Dockerfile Overview
Weaver uses a multi-stage build for minimal image size and security (source/Dockerfile):Key Features
- Multi-stage build: Separates build dependencies from runtime
- Alpine base: Minimal image size (~50MB)
- Health check: Built-in endpoint monitoring
- Automatic onboarding: Creates default config on first run
- Flexible entrypoint: Supports both
agentandgatewaymodes
Building the Image
Build Docker Image
- Compiled Weaver binary
- Default configuration structure
- Health check endpoint at port 18790
Docker Compose Setup
Weaver includes a production-ready compose file (source/docker-compose.yml) with two deployment profiles:Profile 1: One-Shot Agent
For running single queries without persistent state:Profile 2: Long-Running Gateway
For persistent bot service with auto-restart:Deployment Modes
One-Shot Agent Mode
Run a single query and exit:Gateway Mode (Production)
Run persistent bot service:Start Gateway Service
- Starts gateway in background
- Auto-restarts on failure
- Connects to all enabled channels
- Exposes health check on port 18790
Volume Management
Weaver uses Docker volumes for persistent data:Workspace Volume
From docker-compose.yml:15 and :36:- Agent session state
- Conversation history
- Tool execution results
- User files created by agents
Configuration Mount
From docker-compose.yml:14 and :34::ro) for security. Update host file and restart container to apply changes.
Inspecting Volume Data
Health Checks
The Dockerfile includes a health check (Dockerfile:26):Health Check Parameters
- Interval: Check every 30 seconds
- Timeout: Consider unhealthy if check takes >3 seconds
- Start period: Grace period of 5 seconds after container start
- Retries: Mark unhealthy after 3 consecutive failures
Testing Health Endpoint
Production Configuration
Using Environment Variables
Secure secrets with environment variables:Reverse Proxy Setup
For webhook-based channels (LINE, Feishu), use nginx:nginx.conf
Multi-Service Deployment
Deploy with additional services:docker-compose.production.yml
Monitoring and Logging
Container Logs
Resource Usage
Updating Weaver
Restart Service
- Stops old container
- Starts new container
- Preserves volume data
- Maintains zero downtime with health checks
Troubleshooting
Container Exits Immediately
Container Exits Immediately
Check logs for startup errors:Common issues:
- Missing or invalid config.json
- Invalid API keys
- Port 18790 already in use
Health Check Fails
Health Check Fails
Verify health endpoint:If failing:
- Check gateway configuration
- Ensure port 18790 is not blocked
- Review container logs for errors
Configuration Not Applied
Configuration Not Applied
- Ensure config.json has valid JSON syntax
- Verify volume mount path is correct
- Restart container after config changes
- Check environment variable substitution
Permission Denied Errors
Permission Denied Errors
Fix workspace permissions:
Best Practices
Security
Security
- Never commit API keys to version control
- Use environment variables for secrets
- Mount config as read-only (
:ro) - Restrict
allow_fromto trusted users - Keep base image updated (
alpine:3.23)
Reliability
Reliability
- Use
restart: unless-stoppedfor production - Configure health checks
- Monitor container resource usage
- Set up log rotation
- Backup workspace volume regularly
Performance
Performance
- Use Docker BuildKit for faster builds
- Cache go mod dependencies (Dockerfile:11-12)
- Limit container memory if needed
- Use multi-stage builds to reduce image size
Maintenance
Maintenance
- Tag images with version numbers
- Document configuration changes
- Test updates in staging first
- Keep compose files in version control
Next Steps
- Configure Multi-Channel Setup for production bot deployments
- Learn OAuth Authentication for secure provider access
- Review Configuration for advanced settings