-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
executable file
·114 lines (112 loc) · 3.08 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
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
106
107
108
109
110
111
112
113
114
version: '3.8'
services:
talents-api:
container_name: talents-api
image: talents-api
build:
context: .
target: ${NODE_ENV}
dockerfile: Dockerfile
environment:
- TYPEORM_HOST=talents-db
- TYPEORM_PORT=5432
- KC_HOSTNAME=talents-keycloak
volumes:
- .:/app
- /app/node_modules
- ./logs:/logs
ports:
- ${API_PORT}:${API_PORT}
entrypoint: [ "sh", "-c", "dockerize -wait tcp://talents-db:5432 && npm run migration:run && npm run keycloak:seed && npm start" ]
networks:
- talents-net
depends_on:
talents-db:
condition: service_healthy
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
talents-db:
container_name: talents-db
image: postgres:14.1-alpine
env_file:
- .env
- ./env/.env.api-db
expose:
- ${TYPEORM_PORT}
ports:
- ${TYPEORM_PORT}:5432
volumes:
- pgdata:/var/lib/postgresql/data
- ./src/scripts/init_db.sh:/docker-entrypoint-initdb.d/init.sh
networks:
- talents-net
healthcheck:
test: [ "CMD-SHELL", "pg_isready -h talents-db -U ${TYPEORM_USERNAME}" ]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
talents-keycloak:
container_name: talents-keycloak
build:
context: .
target: ${NODE_ENV}
dockerfile: ${NODE_ENV}-kc.Dockerfile
environment:
- KEYCLOAK_ADMIN=${KEYCLOAK_ADMIN}
- KEYCLOAK_ADMIN_PASSWORD=${KEYCLOAK_ADMIN_PASSWORD}
- KC_HOSTNAME=${KC_HOSTNAME}
- KC_PROFILE=${KC_PROFILE}
- KC_HEALTH_ENABLED=true
- KEYCLOAK_PORT=${KEYCLOAK_PORT}
- KC_HOSTNAME_STRICT=false
- KC_HOSTNAME_STRICT_HTTPS=false
- PROXY_ADDRESS_FORWARDING=true
env_file:
- .env
ports:
- "${KEYCLOAK_PORT}:${KEYCLOAK_PORT}"
entrypoint: [
"sh",
"-c",
"dockerize -wait tcp://talents-keycloak-db:5432 -timeout 1m && KC_HEALTH_ENABLED=true /opt/keycloak/bin/kc.sh start-dev --db=${KEYCLOAK_DB_VENDOR} --db-username=${KEYCLOAK_DB_USER} --db-password=${KEYCLOAK_DB_PASSWORD} --hostname=${KC_HOSTNAME} --http-port=${KEYCLOAK_PORT} --db-url=${KEYCLOAK_DB_URL}"
]
depends_on:
talents-keycloak-db:
condition: service_healthy
volumes:
- keycloakdata:/opt/keycloak/data
networks:
- talents-net
talents-keycloak-db:
container_name: talents-keycloak-db
image: postgres:14.1-alpine
env_file:
- .env
- ./env/.env.keycloak-db
expose:
- ${KEYCLOAK_DB_PORT}
ports:
- ${KEYCLOAK_DB_PORT}:5432
volumes:
- ~/docker_data/keycloak_db:/var/lib/postgresql/data
- ./src/scripts/init_keycloak_db.sh:/docker-entrypoint-initdb.d/init.sh
networks:
- talents-net
healthcheck:
test: [ "CMD-SHELL", "pg_isready -h talents-keycloak-db -U ${KEYCLOAK_DB_USER}" ]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
talents-net:
external: false
volumes:
keycloakdata:
driver: local
pgdata:
driver: local