-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
95 lines (90 loc) · 2.18 KB
/
docker-compose.yml
File metadata and controls
95 lines (90 loc) · 2.18 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
services:
goserver:
build:
context: .
dockerfile: Dockerfile
container_name: goserver-postgres
restart: unless-stopped
env_file: .env
ports:
- '${SERVER_PORT}:${SERVER_PORT}'
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
networks:
- goserve-postgres-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
postgres:
image: postgres:18.1
restart: unless-stopped
env_file: .env
ports:
- '${DB_PORT}:5432'
volumes:
- dbdata:/data/db
# optional pg seed scripts
- ./.extra/setup/init-test-db.sql:/docker-entrypoint-initdb.d/init-test-db.sql:ro
- ./.extra/setup/pgseed.sql:/docker-entrypoint-initdb.d/pgseed.sql:ro
networks:
- goserve-postgres-network
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -h localhost -p 5432 -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""
]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
redis:
image: redis:8.4.0
restart: unless-stopped
env_file: .env
ports:
- '${REDIS_PORT}:6379'
command: redis-server --bind 0.0.0.0 --save 20 1 --loglevel warning --requirepass ${REDIS_PASSWORD}
volumes:
- cache:/data/cache
networks:
- goserve-postgres-network
healthcheck:
test:
[
"CMD",
"redis-cli",
"-a", "${REDIS_PASSWORD}",
"ping"
]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
migrate:
image: migrate/migrate
env_file: .test.env
volumes:
- ./migrations:/migrations
depends_on:
postgres:
condition: service_healthy
networks:
- goserve-postgres-network
entrypoint: ["/bin/sh", "-c"]
command:
- |
migrate -path /migrations -database "postgres://$${DB_USER}:$${DB_USER_PWD}@postgres:5432/$${DB_NAME}?sslmode=disable" up
networks:
goserve-postgres-network:
driver: bridge
volumes:
dbdata:
cache:
driver: local