-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.example.yaml
65 lines (60 loc) · 1.72 KB
/
docker-compose.example.yaml
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
version: '3.9'
# ======> READ THIS FIRST <======
# You have two options for the config file:
# Option 1 => You can map to the default path in docker [/app/config/config.yaml] and run the app without the --config flag
# Option 2 => You can map to a custom path in docker but you must run the app with the --config flag
services:
api:
build: .
image: go-boilerplate:latest
restart: on-failure:10
command: [ "serve-api", "--config=/config/config.yaml" ]
volumes:
- ./config/config.yaml:/config/config.yaml
ports:
- 8082:8082
depends_on:
- postgres
- migrate
scheduler:
build: .
image: go-boilerplate:latest
restart: on-failure:10
command: [ "schedule:run", "--config=/config/config.yaml" ]
volumes:
- ./config/config.yaml:/config/config.yaml
depends_on:
- postgres
- migrate
migrate:
build: .
image: go-boilerplate:latest
restart: on-failure:10
command: [ "migrate", "--config=/config/config.yaml" ]
volumes:
- ./config/config.yaml:/config/config.yaml
depends_on:
- postgres
postgres:
image: postgres:14.6-alpine3.17
restart: on-failure
volumes:
- ../tmp/postgres:/var/lib/postgresql/data
environment:
POSTGRES_USER: my_user
POSTGRES_PASSWORD: my_password
POSTGRES_DB: my_db
ports:
- 5432:5432
healthcheck:
test: [ "CMD", "pg_isready", "-U", "my_user", "-d", "my_db" ]
interval: 5s
timeout: 5s
retries: 20
# Uncomment this section if you want to use mongo
# mongo:
# image: mongo:6.0.4-jammy
# restart: always
# environment:
# MONGO_INITDB_ROOT_USERNAME: mongo_user
# MONGO_INITDB_ROOT_PASSWORD: mongo_password