-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
105 lines (99 loc) · 2.65 KB
/
Copy pathdocker-compose.yml
File metadata and controls
105 lines (99 loc) · 2.65 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
version: '3.8'
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=dev
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/project
- SPRING_DATASOURCE_USERNAME=${DB_USER:-postgres}
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWORD:-postgres}
- SPRING_JPA_HIBERNATE_DDL_AUTO=update
- SPRING_JPA_SHOW_SQL=false
- KEYCLOAK_AUTH_URL=http://keycloak:8080/auth
- KEYCLOAK_REALM=your-realm
- KEYCLOAK_CLIENT_ID=your-client-id
depends_on:
db:
condition: service_healthy
keycloak:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/api/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 30s
networks:
- app-network
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "80:80"
depends_on:
- backend
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 30s
networks:
- app-network
keycloak:
image: quay.io/keycloak/keycloak:24.0.1
command:
- start-dev
- --import-realm
ports:
- "8081:8080"
environment:
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin
- KC_DB=postgres
- KC_DB_URL=jdbc:postgresql://db:5432/keycloak
- KC_DB_USERNAME=${DB_USER:-postgres}
- KC_DB_PASSWORD=${DB_PASSWORD:-postgres}
volumes:
- ./keycloak/realm-export.json:/opt/keycloak/data/import/realm-export.json:ro
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health/ready"]
interval: 30s
timeout: 3s
retries: 3
start_period: 30s
networks:
- app-network
db:
image: postgres:14
ports:
- "5432:5432"
environment:
- POSTGRES_MULTIPLE_DATABASES=project,keycloak
- POSTGRES_USER=${DB_USER:-postgres}
- POSTGRES_PASSWORD=${DB_PASSWORD:-postgres}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init-multiple-dbs.sh:/docker-entrypoint-initdb.d/init-multiple-dbs.sh
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- app-network
networks:
app-network:
driver: bridge
volumes:
postgres_data:
driver: local