-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yml
44 lines (42 loc) · 1.2 KB
/
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
services:
web:
build:
context: .
dockerfile: Dockerfile
container_name: example-web
ports:
- ${PORT:-8080}:8080
environment:
- DATABASE_URL=jdbc:postgresql://db:5432/${DATABASE_NAME:-example}
- DATABASE_USERNAME=${DATABASE_USERNAME:-postgres}
- DATABASE_PASSWORD=${DATABASE_PASSWORD:-postgres}
depends_on:
db:
condition: service_healthy
cron:
build:
context: .
dockerfile: cron.Dockerfile
container_name: example-cron
environment:
- DATABASE_URL=jdbc:postgresql://db:5432/${DATABASE_NAME:-example}
- DATABASE_USERNAME=${DATABASE_USERNAME:-postgres}
- DATABASE_PASSWORD=${DATABASE_PASSWORD:-postgres}
depends_on:
db:
condition: service_healthy
db:
image: postgres:15
container_name: example-db
ports:
- 5432:5432
environment:
- POSTGRES_DB=${DATABASE_NAME:-example}
- POSTGRES_USER=${DATABASE_USERNAME:-postgres}
- POSTGRES_PASSWORD=${DATABASE_PASSWORD:-postgres}
- PGDATA=/var/lib/postgresql/data/pgdata
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USERNAME:-postgres}"]
interval: 5s
timeout: 5s
retries: 5