|
| 1 | +# documentation: https://www.keycloak.org |
| 2 | +# slogan: Keycloak is an open-source Identity and Access Management tool. |
| 3 | +# tags: keycloak,identity,access,management,iam,authentication,authorization,security,oauth2,openid-connect,sso,single-sign-on,saml,rbac,ldap,jwt,social-login |
| 4 | +# logo: svgs/keycloak.svg |
| 5 | +# port: 8080 |
| 6 | + |
| 7 | +services: |
| 8 | + keycloak: |
| 9 | + image: quay.io/keycloak/keycloak:25.0.2 |
| 10 | + command: |
| 11 | + - start |
| 12 | + environment: |
| 13 | + - PUID=1000 |
| 14 | + - PGID=1000 |
| 15 | + - TZ=Europe/Berlin |
| 16 | + - KEYCLOAK_ADMIN=${KEYCLOAK_ADMIN:-admin} |
| 17 | + - KEYCLOAK_ADMIN_PASSWORD=${KEYCLOAK_ADMIN_PASSWORD:-password} |
| 18 | + - KC_DB=postgres |
| 19 | + - KC_DB_USERNAME=${SERVICE_USER_DATABASE} |
| 20 | + - KC_DB_PASSWORD=${SERVICE_PASSWORD_64_DATABASE} |
| 21 | + - KC_DB_URL_PORT=5432 |
| 22 | + - KC_DB_URL=jdbc:postgresql://postgres/${POSTGRESQL_DATABASE:-keycloak} |
| 23 | + - KC_HOSTNAME=${SERVICE_FQDN_KEYCLOAK_8080} |
| 24 | + - KC_ENABLE_HTTPS=false |
| 25 | + - KC_HTTP_ENABLED=true |
| 26 | + - KC_HEALTH_ENABLED=true |
| 27 | + - KC_DB_POOL_INITIAL_SIZE=${KEYCLOAK_DB_POOL_INITIAL_SIZE} |
| 28 | + - KC_DB_POOL_MIN_SIZE=${KEYCLOAK_DB_POOL_MIN_SIZE:-0} |
| 29 | + - KC_DB_POOL_MAX_SIZE=${KEYCLOAK_DB_POOL_MAX_SIZE:-100} |
| 30 | + - KC_METRICS_ENABLED=${KEYCLOAK_METRICS_ENABLED:-false} |
| 31 | + - KC_DIR=${KEYCLOAK_DIR} |
| 32 | + - KC_FILE=${KEYCLOAK_FILE} |
| 33 | + - KC_OVERRIDE=${KEYCLOAK_OVERRIDE:-true} |
| 34 | + volumes: |
| 35 | + - keycloak-data:/opt/keycloak/data |
| 36 | + depends_on: |
| 37 | + postgres: |
| 38 | + condition: service_healthy |
| 39 | + healthcheck: |
| 40 | + test: ["CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/9000;echo -e 'GET /health/ready HTTP/1.1\r\nhost: http://localhost\r\nConnection: close\r\n\r\n' >&3;if [ $? -eq 0 ]; then echo 'Healthcheck Successful';exit 0;else echo 'Healthcheck Failed';exit 1;fi;"] |
| 41 | + interval: 5s |
| 42 | + timeout: 20s |
| 43 | + retries: 10 |
| 44 | + postgres: |
| 45 | + image: postgres:16-alpine |
| 46 | + volumes: |
| 47 | + - postgresql-data:/var/lib/postgresql/data |
| 48 | + environment: |
| 49 | + - POSTGRES_USER=${SERVICE_USER_DATABASE} |
| 50 | + - POSTGRES_PASSWORD=${SERVICE_PASSWORD_64_DATABASE} |
| 51 | + - POSTGRES_DB=${POSTGRESQL_DATABASE:-keycloak} |
| 52 | + healthcheck: |
| 53 | + test: |
| 54 | + - CMD-SHELL |
| 55 | + - pg_isready -U $${SERVICE_USER_DATABASE} -d $${POSTGRESQL_DATABASE} |
| 56 | + interval: 5s |
| 57 | + timeout: 20s |
| 58 | + retries: 10 |
0 commit comments