-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
75 lines (70 loc) · 1.53 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
services:
db:
restart: always
image: postgres:13-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
env_file:
- .env
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
- shared_network
redis:
image: redis
ports:
- "6380:6379"
networks:
- shared_network
api:
restart: "no" # Ensures that Docker doesn't automatically restart after failure
build:
context: ./
dockerfile: Dockerfile
volumes:
- .:/build
ports:
- "8000:8000"
environment:
- POSTGRES_SERVER=db
- REDIS_URL=redis:6379
env_file:
- .env
depends_on:
- db
- redis
command: air ./main.go -b 0.0.0.0
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/general/site-detail"] # Health check endpoint
interval: 30s
retries: 3
start_period: 10s
timeout: 5s
networks:
- shared_network
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4
environment:
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD}
env_file:
- .env
ports:
- "5050:80"
depends_on:
- db
networks:
- shared_network
volumes:
postgres_data:
networks:
shared_network:
driver: bridge