# Site Builder - Docker Container

## Quick Start

**Start the container:**
```bash
cd /home/jknapp/code/site-builder
docker-compose up -d
```

**Or use the management script:**
```bash
./docker-manage.sh start
```

**Access the site builder:**
- From Windows: http://localhost:8081
- From WSL: http://localhost:8081

## Benefits

- ✅ **Auto-restarts** - Container restarts automatically if it crashes
- ✅ **Survives reboots** - Container auto-starts on system boot (unless stopped manually)
- ✅ **Live updates** - Files are mounted, changes reflect immediately (no rebuild needed)
- ✅ **Stable** - nginx is rock-solid, won't crash like Python server

## Management

**Using docker-manage.sh script:**
```bash
./docker-manage.sh start     # Start the container
./docker-manage.sh stop      # Stop the container
./docker-manage.sh restart   # Restart the container
./docker-manage.sh logs      # View logs (Ctrl+C to exit)
./docker-manage.sh status    # Check if running
```

**Using docker-compose directly:**
```bash
docker-compose up -d         # Start in background
docker-compose down          # Stop and remove
docker-compose restart       # Restart
docker-compose logs -f       # View logs
docker-compose ps            # Check status
```

## Technical Details

- **Image:** nginx:alpine (lightweight, ~40MB)
- **Port:** 8081 (host) → 80 (container)
- **Volume:** Current directory mounted read-only to `/usr/share/nginx/html`
- **Restart policy:** unless-stopped (auto-restarts on crash, survives reboots)

## Troubleshooting

**Container not starting?**
```bash
docker-compose logs
```

**Port already in use?**
```bash
sudo lsof -i :8081  # See what's using the port
# Or change port in docker-compose.yml
```

**Rebuild if needed:**
```bash
docker-compose down
docker-compose up -d --force-recreate
```
