-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
80 lines (75 loc) · 2.09 KB
/
Copy pathdocker-compose.yml
File metadata and controls
80 lines (75 loc) · 2.09 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
name: todolist
# This file starts a PostgreSQL database in a docker container, which is required for running the application and tests locally.
# It also starts pgAdmin (a web-based PostgreSQL management tool) in a second container, which lets you query the database.
#
# Usage:
# docker compose up --detach --wait
#
# To connect to pgAdmin, open http://localhost:5050. It will automatically log in and connect to the database.
#
# To stop:
# docker compose down
#
# To stop and remove persistent data (reset):
# docker compose down --volumes
services:
postgres-db:
image: postgres:latest
pull_policy: always
container_name: todolist-postgres-db
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 1s
timeout: 3s
retries: 5
start_period: 2s
pgadmin:
image: dpage/pgadmin4:latest
pull_policy: always
container_name: todolist-pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: postgres
PGADMIN_CONFIG_SERVER_MODE: 'False'
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False'
PGADMIN_DISABLE_POSTFIX: 'true'
PGADMIN_REPLACE_SERVERS_ON_STARTUP: 'True'
ports:
- "5050:80"
depends_on:
- postgres-db
volumes:
- pgadmin-data:/var/lib/pgadmin
healthcheck:
test: ["CMD", "wget", "-O", "-", "http://localhost:80/misc/ping"]
interval: 2s
timeout: 3s
retries: 25
start_period: 20s
configs:
- source: pgadmin-servers
target: /pgadmin4/servers.json
volumes:
pgadmin-data:
configs:
pgadmin-servers:
content: |
{
"Servers": {
"1": {
"Name": "todolist-postgres-database",
"Group": "Servers",
"Host": "postgres-db",
"Port": 5432,
"MaintenanceDB": "postgres",
"Username": "postgres",
"SSLMode": "prefer",
"PasswordExecCommand": "echo 'postgres'"
}
}
}