Add a docker-compose.yml to run a local development stack: Postgres (with mounted init scripts), Redis, MinIO, Keycloak (start-dev) and pgAdmin, plus a bridge network and persistent volumes. Also add init/init.sql to create the keycloak database and grant privileges to the admin user so Keycloak can connect to its dedicated DB. Default credentials and port mappings are provided for development convenience.
90 lines
2.0 KiB
YAML
90 lines
2.0 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: postgres
|
|
restart: unless-stopped
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
POSTGRES_USER: admin
|
|
POSTGRES_PASSWORD: admin
|
|
POSTGRES_DB: postgres
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./init:/docker-entrypoint-initdb.d # place init.sql here to create additional databases
|
|
networks:
|
|
- backend
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: redis
|
|
restart: unless-stopped
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
networks:
|
|
- backend
|
|
|
|
minio:
|
|
image: minio/minio:latest
|
|
container_name: minio
|
|
restart: unless-stopped
|
|
ports:
|
|
- "9000:9000" # API
|
|
- "9001:9001" # Web console
|
|
environment:
|
|
MINIO_ROOT_USER: minioadmin
|
|
MINIO_ROOT_PASSWORD: minioadmin
|
|
volumes:
|
|
- minio_data:/data
|
|
command: server /data --console-address ":9001"
|
|
networks:
|
|
- backend
|
|
|
|
keycloak:
|
|
image: quay.io/keycloak/keycloak:latest
|
|
container_name: keycloak
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8180:8080" # Host port 8180 → container 8080 (Keycloak default)
|
|
environment:
|
|
KEYCLOAK_ADMIN: admin
|
|
KEYCLOAK_ADMIN_PASSWORD: admin
|
|
KC_DB: postgres
|
|
KC_DB_URL: jdbc:postgresql://postgres:5432/keycloak
|
|
KC_DB_USERNAME: admin
|
|
KC_DB_PASSWORD: admin
|
|
command: start-dev # Use start-dev for development mode
|
|
depends_on:
|
|
- postgres
|
|
networks:
|
|
- backend
|
|
|
|
pgadmin:
|
|
image: dpage/pgadmin4:latest
|
|
container_name: pgadmin
|
|
restart: unless-stopped
|
|
ports:
|
|
- "5050:80" # pgAdmin web UI
|
|
environment:
|
|
PGADMIN_DEFAULT_EMAIL: admin@example.com
|
|
PGADMIN_DEFAULT_PASSWORD: admin
|
|
volumes:
|
|
- pgadmin_data:/var/lib/pgadmin
|
|
depends_on:
|
|
- postgres
|
|
networks:
|
|
- backend
|
|
|
|
networks:
|
|
backend:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
minio_data:
|
|
pgadmin_data: |