-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yml
More file actions
48 lines (45 loc) · 1.14 KB
/
Copy pathcompose.yml
File metadata and controls
48 lines (45 loc) · 1.14 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
services:
db:
image: 'postgres:15-alpine'
environment:
POSTGRES_USER: ${DB_USERNAME:-dba}
POSTGRES_PASSWORD: ${DB_PASSWORD:-secretsecret}
POSTGRES_DB: ${DB_NAME:-hellojpa-db}
# Only expose ports if you need to connect from your host machine (e.g., via DBeaver)
# ports:
# - "5432:5432"
volumes:
- pg-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-dba} -d ${DB_NAME:-hellojpa-db}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- backend
app:
image: 'brunoe/sample-hellojpa:latest'
build:
context: .
# Encourages using the BuildKit cache we set up in the Dockerfile
dockerfile: Dockerfile
depends_on:
db:
condition: service_healthy
environment:
DB_USERNAME: ${DB_USERNAME:-dba}
DB_PASSWORD: ${DB_PASSWORD:-secretsecret}
DB_URL: ${DB_URL:-jdbc:postgresql://db/hellojpa-db}
deploy:
resources:
limits:
memory: 512M
cpus: '1.0'
ports:
- "8080:8080"
networks:
- backend
networks:
backend:
volumes:
pg-data: