# Moltbot Custom Docker Image

This directory contains the Dockerfile and scripts to build a custom Docker image for Moltbot (clawdbot) with pre-installed dependencies.

## Why?

The original deployment installed `clawdbot` via npm on every pod startup, causing slow startup times (2-3 minutes). This custom image pre-installs clawdbot during the Docker build, reducing startup time to seconds.

## What's Included

- **Dockerfile**: Base image with clawdbot pre-installed
- **docker-entrypoint.sh**: Entrypoint script that configures clawdbot for Kubernetes environment

## Configuration

The entrypoint automatically creates the clawdbot config with:
- Trusted proxies for Kubernetes pod networks (10.42.0.0/16, 10.43.0.0/16)
- Token-based authentication
- Insecure auth mode (safe behind reverse proxy)
- Gateway binding to LAN interface

## Building Locally

```bash
cd docker/moltbot
docker build -t moltbot:local .
docker run -p 18789:18789 moltbot:local
```

## GitHub Actions

The image is automatically built and pushed to GitHub Container Registry (ghcr.io) when:
- Changes are pushed to `main` branch affecting `docker/moltbot/**`
- Workflow is manually triggered

Image location: `ghcr.io/wahyd4/home-docker/moltbot:latest`

## Startup Time Improvement

- **Before**: ~180 seconds (npm install on every startup)
- **After**: ~15 seconds (pre-installed image)
- **Savings**: ~90% faster startup time
