-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
97 lines (91 loc) · 2.03 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
version: '3.8'
#Also you can use these if you do not want to build own local
#server: `isikhi/go-rate-limiter:app-0.1.0`
#migrate_server: `isikhi/go-rate-limiter:migrate-0.1.0`
#seed_server: `isikhi/go-rate-limiter:seed-0.1.0`
services:
server:
image: "server"
container_name: "server_container"
env_file:
- .env
build:
context: .
args:
- MAIN_GO_FILE_PATH=./cmd/app/main.go
dockerfile: Dockerfile
ports:
- 0.0.0.0:${API_PORT}:${API_PORT}
- 0.0.0.0:${API_RPCPORT}:${API_RPCPORT}
networks:
- app-network
depends_on:
- redis
- postgres
- migrate_server
- seed_server
migrate_server:
image: "migrate_server"
container_name: "migrate_server_container"
env_file:
- .env
build:
context: .
args:
- MAIN_GO_FILE_PATH=./cmd/migrate/main.go
dockerfile: Dockerfile
networks:
- app-network
depends_on:
- redis
- postgres
seed_server:
image: "seed_server"
container_name: "seed_server_container"
env_file:
- .env
build:
context: .
dockerfile: Dockerfile
args:
- MAIN_GO_FILE_PATH=./cmd/seed/main.go
networks:
- app-network
depends_on:
- redis
- postgres
- migrate_server
postgres:
image: "postgres:16.0"
restart: always
container_name: "go8_postgres"
healthcheck:
test: pg_isready -U ${DB_USER}
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASS}
- POSTGRES_DB=${DB_NAME}
ports:
- 0.0.0.0:${DB_PORT}:5432
expose:
- "5432"
volumes:
- postgres:/var/lib/postgresql/data
- ./scripts/create-db.sh:/docker-entrypoint-initdb.d
networks:
- app-network
redis:
image: 'redis:7.2'
restart: always
ports:
- 0.0.0.0:${REDIS_PORT}:6379
environment:
- ALLOW_EMPTY_PASSWORD=yes
networks:
- app-network
volumes:
postgres:
networks:
app-network:
name: app-network
driver: bridge