-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
39 lines (35 loc) · 953 Bytes
/
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
version: '3.8'
services:
db:
container_name: some-postgres
image: postgres
env_file:
- .env
environment:
PGDATA: /data/postgres
volumes:
- postgres:/data/postgres
ports:
- '5432:5432'
# Great solution for the startup problem I was having I found on https://stackoverflow.com/questions/35069027/
# Instead of just a raw depends_on, this will wait for the postgres container to be healthy before starting the web container
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 3s
timeout: 3s
retries: 5
web:
build:
context: .
ports:
- '5555:5555'
volumes:
- .:/usr/src/app
command: ./bin/gobank --seed
depends_on:
db:
# Specify that the web container should wait for the db container to be healthy before starting
# This is the important part
condition: service_healthy
volumes:
postgres: