feat: add multi-stage Dockerfile and docker-compose.yml
- Multi-stage Dockerfile: golang:1.24-alpine builder → alpine:3.21 runtime - CGO_ENABLED=0 for static binary, stripped with -ldflags="-s -w" - Only copies ca-certificates and tzdata to runtime image - Config via volume mount at /etc/gosearch/config.toml - docker-compose.yml: gosearch + Valkey 8 - Valkey healthcheck ensures gosearch starts after cache is ready - Persistent Valkey volume - config.toml mounted read-only - Update .gitignore with Go build artifacts
This commit is contained in:
parent
94322ceff4
commit
4c54ed5b56
4 changed files with 70 additions and 0 deletions
33
docker-compose.yml
Normal file
33
docker-compose.yml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Docker Compose for gosearch + Valkey
|
||||
#
|
||||
# Usage:
|
||||
# cp config.example.toml config.toml # edit as needed
|
||||
# docker compose up -d
|
||||
|
||||
services:
|
||||
gosearch:
|
||||
build: .
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./config.toml:/etc/gosearch/config.toml:ro
|
||||
depends_on:
|
||||
valkey:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
|
||||
valkey:
|
||||
image: valkey/valkey:8
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- valkey-data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "valkey-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
valkey-data:
|
||||
Loading…
Add table
Add a link
Reference in a new issue