fix: address code review findings

- Create README.md with project overview, quick start, Docker deployment, CI/CD info
- Update CLAUDE.md with Deployment section
- Fix cmd/api/main.go to use REDIS_ADDR env var with fallback
- Fix Dockerfile to use golang:1.22-alpine instead of golang:1.26-alpine
- Fix .gitea/workflows/deploy.yml to include Docker registry prefix in image tags
This commit is contained in:
2026-08-19 01:11:55 +03:00
parent da67d0eae7
commit b14682f424
4 changed files with 37 additions and 4 deletions

View File

@@ -76,6 +76,35 @@ go fmt ./...
go vet ./...
```
## Deployment
### Docker Deployment
The project uses a multi-stage Dockerfile:
- **Builder stage**: `golang:1.22-alpine` to build `api` and `cron` binaries
- **Runtime stage**: `alpine:latest` with minimal footprint (~27MB)
### Docker Compose
The `docker-compose.yml` includes:
- `api` service: Go HTTP server on port 8080
- `cron` service: Go cron binary for reference data updates and station status detection
- `postgres`: PostgreSQL 15-alpine with `postgres_data` volume
- `redis`: Redis 7-alpine with `redis_data` volume
- `watchtower`: nickfedor/watchtower for automatic container updates (interval: 60s)
### CI/CD Pipeline
Gitea Actions workflow (`.gitea/workflows/deploy.yml`) provides:
- Checkout code
- Setup Go 1.22+
- Go modules cache
- Lint with golangci-lint v1.54.2
- Run tests with race detector: `go test -v -race ./...`
- Docker Buildx setup
- Docker login to registry
- Build and push Docker image with tags: `latest` and commit SHA
### API Endpoints (from specification)
- `GET /v1/cities?query=` — City autocomplete