-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdocker-compose.yml
68 lines (63 loc) · 2.5 KB
/
docker-compose.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
65
66
67
68
services:
app_1:
# This is the demo app we want to provide behind authentication
image: nginx:1.27.1
depends_on:
- nginx
nginx:
build: .
image: ghcr.io/flavienbwk/nginx-keycloak/nginx-sso:20240921
# Following command auto-replaces env variables in NGINX configuration
command: /bin/bash -c "envsubst < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && /usr/local/openresty/nginx/sbin/nginx -g 'daemon off;'"
ports:
- 3002:3002
volumes:
- ./logs:/var/log/nginx
- ./nginx.conf.template:/etc/nginx/conf.d/nginx.conf.template
#- ./nginx-roles.conf.template:/etc/nginx/conf.d/nginx.conf.template
environment:
KEYCLOAK_INTERNAL_ENDPOINT: ${KEYCLOAK_INTERNAL_ENDPOINT}
KEYCLOAK_EXTERNAL_ENDPOINT: ${KEYCLOAK_EXTERNAL_ENDPOINT}
KEYCLOAK_LOGOUT_REDIRECT_URI: ${KEYCLOAK_LOGOUT_REDIRECT_URI}
KEYCLOAK_REALM: ${KEYCLOAK_REALM}
KEYCLOAK_CLIENT: ${KEYCLOAK_CLIENT}
KEYCLOAK_SECRET: ${KEYCLOAK_SECRET}
depends_on:
keycloak:
condition: service_healthy
postgres:
image: postgres:15
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
keycloak:
image: keycloak/keycloak:25.0.6
command: start-dev
environment:
KC_DB: postgres
KC_DB_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB}
KC_DB_USERNAME: ${POSTGRES_USER}
KC_DB_PASSWORD: ${POSTGRES_PASSWORD}
KC_HEALTH_ENABLED: true
KEYCLOAK_ADMIN: ${KEYCLOAK_USER}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_PASSWORD}
ports:
- 3333:8080
healthcheck:
test: ["CMD-SHELL", "exec 3<>/dev/tcp/localhost/9000;echo -e \"GET /health/ready HTTP/1.1\r\nhost: http://localhost\r\nConnection: close\r\n\r\n\" >&3;grep \"HTTP/1.1 200 OK\" <&3"]
interval: 10s
timeout: 5s
retries: 5
depends_on:
postgres:
condition: service_healthy
volumes:
postgres_data: