Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
112 lines (106 loc) · 2.63 KB
/
Copy pathdocker-compose.yml
File metadata and controls
112 lines (106 loc) · 2.63 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
services:
# 1. THE DATABASE
postgres:
image: postgres:15-alpine
container_name: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${DB_NAME}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
volumes:
- ./data:/var/lib/postgresql
networks:
- backend
db-init-user:
image: postgres:15-alpine
container_name: db-init-user
volumes:
- ./scripts/init-user.sh:/init-user.sh
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
command: ["/bin/bash", "/init-user.sh"]
networks:
- backend
depends_on:
- postgres
migrate:
image: migrate/migrate
container_name: db-migrate
volumes:
- ./migrations/:/migrations
command:
[
"-path",
"/migrations",
"-database",
"postgres://postgres:${POSTGRES_PASSWORD}@postgres:5432/${DB_NAME}?sslmode=disable",
"up",
]
networks:
- backend
depends_on:
postgres:
condition: service_healthy
api:
container_name: api
build: .
ports:
- "${SERVER_PORT:-8080}:8080"
environment:
DB_HOST: postgres
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME}
networks:
- backend
depends_on:
postgres:
condition: service_started
db-init-user:
condition: service_completed_successfully
migrate:
condition: service_completed_successfully
minio:
container_name: minio
image: minio/minio
ports:
- "${MINIO_PORT:-9000}:${MINIO_PORT:-9000}"
- "${MINIO_PORT_ADMIN:-9001}:${MINIO_PORT_ADMIN:-9001}"
environment:
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
MINIO_DEFAULT_BUCKETS: ${MINIO_BUCKET_NAME}
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
networks:
- backend
volumes:
- ./minio-data:/data
command: server --console-address :9001 /data
minio-init:
container_name: minio-init
image: minio/mc
volumes:
- ./scripts/init-minio.sh:/init-minio.sh
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
MINIO_BUCKET_NAME: ${MINIO_BUCKET_NAME}
entrypoint: /bin/sh
command: ["/init-minio.sh"]
networks:
- backend
depends_on:
- minio
networks:
backend:
driver: bridge