-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
60 lines (56 loc) · 1.25 KB
/
docker-compose.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
services:
air:
container_name: 'api_air'
build:
context: .
dockerfile: Dockerfile
depends_on:
db_migrate:
condition: service_completed_successfully
cache:
condition: service_started
ports:
- '${API_PORT}:${API_PORT}'
volumes:
- ./:/app
db:
container_name: 'api_db'
image: postgres:16.2-alpine
restart: always
healthcheck:
test: pg_isready -d ${DB_NAME} -U ${DB_USER}
interval: 5s
timeout: 20s
retries: 120
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_NAME}
ports:
- '${DB_PORT}:5432'
volumes:
- pgdata:/var/lib/postgresql/data
db_migrate:
container_name: 'api_db_migrate'
image: migrate/migrate
depends_on:
db:
condition: service_healthy
command:
[
'-path',
'/migrations',
'-database',
'postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=${DB_SSL_MODE}',
'up',
]
volumes:
- ./migrations:/migrations
cache:
container_name: 'api_cache'
image: redis:7.2-alpine
restart: always
ports:
- '${CACHE_PORT}:6379'
volumes:
pgdata: