prod & dev docker containers

This commit is contained in:
Maxime Van Hees
2025-10-30 14:07:08 +01:00
parent 592b6c1ea9
commit 9f7ebc6e57
5 changed files with 201 additions and 2 deletions

91
docker-compose.yml Normal file
View File

@@ -0,0 +1,91 @@
services:
# Production service
herodb-prod:
build:
context: .
dockerfile: Dockerfile
container_name: herodb-production
restart: unless-stopped
ports:
- "6379:6379"
- "8080:8080"
volumes:
- herodb-data:/data
# Optional: Unix socket for IPC
- herodb-ipc:/tmp
environment:
- RUST_LOG=${RUST_LOG:-info}
command: >
--dir /data
--port 6379
--admin-secret ${ADMIN_SECRET}
--enable-rpc
--rpc-port 8080
--enable-rpc-ipc
--rpc-ipc-path /tmp/herodb.ipc
healthcheck:
test: ["CMD", "timeout", "2", "bash", "-c", "</dev/tcp/localhost/6379"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
networks:
- herodb-network
# Development service
herodb-dev:
build:
context: .
dockerfile: Dockerfile.dev
container_name: herodb-development
ports:
- "6380:6379" # Different port to avoid conflicts
- "8081:8080"
volumes:
- ./:/app
- cargo-cache:/usr/local/cargo/registry
- target-cache:/app/target
- herodb-dev-data:/data
environment:
- RUST_LOG=debug
- RUST_BACKTRACE=1
command: >
cargo run --
--dir /data
--port 6379
--admin-secret ${ADMIN_SECRET:-devsecret}
--enable-rpc
--rpc-port 8080
--debug
stdin_open: true
tty: true
networks:
- herodb-network
# Optional: Redis CLI for testing
redis-cli:
image: redis:7-alpine
container_name: herodb-cli
command: redis-cli -h herodb-prod -p 6379
depends_on:
- herodb-prod
networks:
- herodb-network
profiles:
- tools
volumes:
herodb-data:
driver: local
herodb-dev-data:
driver: local
herodb-ipc:
driver: local
cargo-cache:
driver: local
target-cache:
driver: local
networks:
herodb-network:
driver: bridge