-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
72 lines (68 loc) · 1.9 KB
/
docker-compose.yml
File metadata and controls
72 lines (68 loc) · 1.9 KB
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
69
70
71
72
version: '3.8'
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "8080:8080"
depends_on:
db:
condition: service_healthy # Wait for db to be healthy
keycloak:
condition: service_started # Wait for Keycloak to start
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/ping_db
- SPRING_DATASOURCE_USERNAME=ping_user
- SPRING_DATASOURCE_PASSWORD=ping_password
command: ["sh", "-c", "sleep 10 && java -jar app.jar"]
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "3000:80"
depends_on:
- backend
environment:
- REACT_APP_BACKEND_URL=http://localhost:8080
- REACT_APP_KEYCLOAK_URL=http://localhost:8180
db:
image: postgres:latest
environment:
POSTGRES_USER: ping_user
POSTGRES_PASSWORD: ping_password
POSTGRES_DB: postgres # Default DB for initialization
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
- ./db-init:/docker-entrypoint-initdb.d # Mount init script
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ping_user"]
interval: 5s
timeout: 5s
retries: 5
keycloak:
image: quay.io/keycloak/keycloak:latest
environment:
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin
- KC_DB=postgres
- KC_DB_URL=jdbc:postgresql://db:5432/keycloak_db
- KC_DB_USERNAME=ping_user
- KC_DB_PASSWORD=ping_password
- KC_HOSTNAME=localhost
- KC_HTTP_PORT=8180
- KC_HOSTNAME_STRICT=false
- KC_HOSTNAME_STRICT_HTTPS=false
ports:
- "8180:8180"
depends_on:
db:
condition: service_healthy # Wait for db to be healthy
volumes:
- ./keycloak/ping-realm.json:/opt/keycloak/data/import/ping-realm.json
command: ["start-dev", "--import-realm"]
volumes:
pgdata: