Files
work-club-manager/docker-compose.yml
OpenCode Assistant cf7b47cb69 infra(docker): add Docker Compose with PostgreSQL and Keycloak
- Add docker-compose.yml (v3.9) with postgres:16-alpine and keycloak:26.1 services
- Configure PostgreSQL with separate workclub and keycloak databases
- Setup Keycloak with database backend, admin user, and realm import capability
- Create PostgreSQL init script to provision development databases and users
- Add placeholder realm-export.json for Keycloak realm configuration
- Configure healthchecks and app-network bridge for service discovery
- Document configuration and patterns in learnings.md
2026-03-03 14:07:29 +01:00

68 lines
1.6 KiB
YAML

version: '3.9'
services:
postgres:
image: postgres:16-alpine
container_name: workclub_postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_INITDB_ARGS: "-c default_transaction_isolation=read_committed -c max_connections=200"
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
- ./infra/postgres:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- app-network
command: >
postgres
-c default_transaction_isolation=read_committed
-c max_connections=200
keycloak:
image: quay.io/keycloak/keycloak:26.1
container_name: workclub_keycloak
environment:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KC_DB: postgres
KC_DB_URL: jdbc:postgresql://postgres:5432/keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: keycloakpass
KC_HEALTH_ENABLED: "true"
KC_LOG_LEVEL: INFO
ports:
- "8080:8080"
volumes:
- ./infra/keycloak:/opt/keycloak/data/import
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:8080/health/ready || exit 1"]
interval: 10s
timeout: 5s
retries: 30
start_period: 30s
networks:
- app-network
command: >
start-dev
--import-realm
volumes:
postgres-data:
driver: local
networks:
app-network:
driver: bridge