-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
108 lines (96 loc) · 2.23 KB
/
docker-compose.yaml
File metadata and controls
108 lines (96 loc) · 2.23 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
106
107
108
version: '3.9'
services:
todo-app-backend:
build:
context: ./backend
environment:
- spring.datasource.url=jdbc:postgresql://todoapp-db:5432/todoapp
- redis.host=tokens-db
networks:
- todoapp-network
ports:
- "9080:8080"
depends_on:
- todoapp-db
- tokens-db
todo-app-frontend:
build:
context: ./frontend
networks:
- todoapp-network
ports:
- "9081:4200"
depends_on:
- todo-app-backend
todoapp-db:
image: postgres:15
environment:
POSTGRES_DB: todoapp
POSTGRES_USER: dev@todoapp
POSTGRES_PASSWORD: password@todoapp
volumes:
- todoapp-db-data:/var/lib/postgresql/data
networks:
- todoapp-network
ports:
- "5433:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
interval: 5s
timeout: 3s
retries: 10
start_period: 3s
tokens-db:
image: redis:alpine
command: redis-server --requirepass password@tokens
environment:
- TOKENS_DB_PASSWORD
volumes:
- tokens-db-data:/data
networks:
- todoapp-network
ports:
- "6379:6379"
healthcheck:
test: [ "CMD-SHELL", 'redis-cli -a "$$TOKENS_DB_PASSWORD" PING | grep PONG' ]
interval: 5s
timeout: 3s
retries: 10
start_period: 2s
# ================================== # Build apps # ================================== #
build-todo-app-backend:
image: amazoncorretto:11
volumes:
- ./backend:/app/backend
working_dir: /app/backend
environment:
- spring.datasource.url=jdbc:postgresql://todoapp-db:5432/todoapp
- redis.host=tokens-db
command: ./mvnw clean package
networks:
- todoapp-network
depends_on:
- todoapp-db
- tokens-db
build-todo-app-frontend:
image: node:16.17.0
volumes:
- ./frontend:/app/frontend
working_dir: /app/frontend
command:
- sh
- -c
- |
rm -rf node_modules
rm -rf dist
npm install -g npm-check-updates
npm ci
npm run build
networks:
- todoapp-network
volumes:
todoapp-db-data:
tokens-db-data:
networks:
todoapp-network:
driver: bridge