Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ config.yaml
*.local.yaml
*.local.yml
*.local.json
*.log
*.log
/test/reports/
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ make build # Build optimised binary with version info
make build-local # Build binary to ./build/ (fast, for testing)
make run # Run with version info
make run-debug # Run with debug logging
make docker-build # Build Docker image with goreleaser (requires goreleaser)
make docker-build-local # Build Docker image locally for amd64 (no goreleaser required)
make docker-build-local-arm64 # Build Docker image locally for ARM64 (no goreleaser required)
make docker-run # Run Docker image with local config (amd64)
make ci # Run full CI pipeline locally
make help # Show all available targets
```
Expand Down
60 changes: 60 additions & 0 deletions docs/content/development/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ make dev
| `make lint` | Run golangci-lint |
| `make ready` | Run all checks (test-short, test-race, fmt, lint, align) |

### Docker Commands

| Command | Description |
|---------|-------------|
| `make docker-build-local` | Build Docker image locally for amd64 (no goreleaser required) |
| `make docker-build-local-arm64` | Build Docker image locally for ARM64 (no goreleaser required) |
| `make docker-build` | Build Docker image with goreleaser (requires goreleaser installed) |
| `make docker-run` | Run Docker image with local config (amd64) |

## Configuration

### Development Config
Expand Down Expand Up @@ -183,6 +192,57 @@ Run with hot reload:
air
```

## Docker Development

### Building Docker Images Locally

You can build Docker images without requiring [goreleaser](https://goreleaser.com/):

#### AMD64 (Intel/most systems)

```bash
make docker-build-local
# Produces: ghcr.io/thushan/olla:local-amd64
```

#### ARM64 (Apple Silicon, Raspberry Pi, ARM servers)

```bash
make docker-build-local-arm64
# Produces: ghcr.io/thushan/olla:local-arm64
```

#### Custom architecture

```bash
make docker-build-local DOCKER_ARCH=arm64
# Produces: ghcr.io/thushan/olla:local-arm64
```

If you have goreleaser installed, use the full release build:

```bash
# Full goreleaser build with all platforms and tags
make docker-build
```

### Running the Docker Image

```bash
# Run the locally built image
docker run -p 40114:40114 \
-v "$(pwd)/config/config.local.yaml:/config/config.yaml:ro" \
-e OLLA_CONFIG_FILE=/config/config.yaml \
ghcr.io/thushan/olla:local
Comment thread
coderabbitai[bot] marked this conversation as resolved.

# Or use the convenience make target
make docker-run
Comment thread
coderabbitai[bot] marked this conversation as resolved.
```

!!! warning "Docker Network Configuration"

When running Olla in Docker, ensure your config has `server.host: 0.0.0.0` (not `localhost`). Inside the container, `localhost` binds to the loopback interface and won't be accessible from the host machine, even with published ports (`-p 40114:40114`). Use `0.0.0.0` to listen on all interfaces.

## IDE Configuration

### VS Code
Expand Down
28 changes: 25 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,21 +205,43 @@ build-snapshot:
# Deprecated: use build-local or build-snapshot instead
ready-local: build-snapshot

DOCKER_ARCH ?= amd64

# Build Docker image without goreleaser (for local development)
docker-build-local:
@echo "Building Docker image locally (without goreleaser) for $(DOCKER_ARCH)..."
@echo "Building olla binary to root..."
@CGO_ENABLED=0 GOOS=linux GOARCH=$(DOCKER_ARCH) go build $(LDFLAGS) -o olla .
@echo "Building Docker image..."
@docker build -t ghcr.io/thushan/olla:local-$(DOCKER_ARCH) .
@echo "Cleaning up binary..."
@rm -f olla
Comment thread
coderabbitai[bot] marked this conversation as resolved.
@echo "Docker image built: ghcr.io/thushan/olla:local-$(DOCKER_ARCH)"
@docker images --filter reference='*olla*local*'

# Build Docker image for ARM64 (convenience target)
docker-build-local-arm64:
@$(MAKE) docker-build-local DOCKER_ARCH=arm64

# Build and test Docker image locally
docker-build:
@if ! command -v goreleaser > /dev/null 2>&1; then \
echo "❌ goreleaser not found. Use 'make docker-build-local' instead (no goreleaser required)"; \
exit 1; \
fi
@echo "Building Docker image locally..."
@goreleaser release --snapshot --clean --skip=publish,announce,sign,sbom
@echo "Docker images:"
@docker images | grep olla | head -5

# Run Docker image with local config
# Run Docker image with local config (defaults to amd64)
docker-run:
@echo "Running Docker image with local config..."
@echo "Running Docker image with local config (amd64)..."
@docker run --rm -it \
-p 40114:40114 \
-v "$(shell pwd)/config/config.local.yaml:/config/config.yaml:ro" \
-e OLLA_CONFIG_FILE=/config/config.yaml \
ghcr.io/thushan/olla:latest
ghcr.io/thushan/olla:local-amd64

# Test full release locally (binaries + docker + archives)
release-test:
Expand Down
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ git clone https://github.com/thushan/olla.git && cd olla && make build-release
./bin/olla
```

```bash
# Build Docker image locally (no goreleaser required)
git clone https://github.com/thushan/olla.git && cd olla && make docker-build-local
docker run -p 40114:40114 ghcr.io/thushan/olla:local
```

### Verification

When you have everything running, you can check it's all working with:
Expand Down
Loading