-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.dev.yml
64 lines (61 loc) · 2.03 KB
/
docker-compose.dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
version: '3.8'
services:
keycloakdb:
image: postgres:16
restart: always
environment:
POSTGRES_DB: ${KEYCLOAK_DB_NAME}
POSTGRES_USER: ${KEYCLOAK_DB_USER}
POSTGRES_PASSWORD: ${KEYCLOAK_DB_PASSWORD}
PGPORT: ${KEYCLOAK_DB_PORT}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s
timeout: 5s
retries: 5
volumes:
- ./keycloak/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./keycloak/db:/var/lib/postgresql/data
keycloak:
image: quay.io/keycloak/keycloak:24.0
depends_on:
keycloakdb:
condition: service_healthy
environment:
KC_DB: ${KEYCLOAK_DB_NAME}
KC_DB_URL: jdbc:postgresql://keycloakdb:${KEYCLOAK_DB_PORT}/${KEYCLOAK_DB_NAME}
KC_DB_USERNAME: ${KEYCLOAK_DB_USER}
KC_DB_PASSWORD: ${KEYCLOAK_DB_PASSWORD}
KEYCLOAK_ADMIN: ${KEYCLOAK_USER}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_PASSWORD}
KC_HEALTH_ENABLED: true
restart: always
healthcheck:
test:
[
'CMD-SHELL',
'[ -f /tmp/HealthCheck.java ] || echo "public class HealthCheck { public static void main(String[] args) throws java.lang.Throwable { System.exit(java.net.HttpURLConnection.HTTP_OK == ((java.net.HttpURLConnection)new java.net.URL(args[0]).openConnection()).getResponseCode() ? 0 : 1); } }" > /tmp/HealthCheck.java && java /tmp/HealthCheck.java http://localhost:8080/health/live'
]
interval: 5s
timeout: 5s
retries: 30
ports:
- ${KEYCLOAK_PORT_EXPOSED}:${KEYCLOAK_PORT}
entrypoint: /opt/keycloak/bin/kc.sh start-dev
appdb:
image: postgres:15.8
restart: always
environment:
POSTGRES_DB: ${APP_DB_NAME}
POSTGRES_USER: ${APP_DB_USER}
POSTGRES_PASSWORD: ${APP_DB_PASSWORD}
PGPORT: ${APP_DB_PORT}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s
timeout: 5s
retries: 5
ports:
- ${APP_DB_PORT_EXPOSED}:${APP_DB_PORT}
volumes:
- ./app/db:/var/lib/postgresql/data