-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
39 lines (36 loc) · 1001 Bytes
/
Copy pathdocker-compose.yaml
File metadata and controls
39 lines (36 loc) · 1001 Bytes
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
version: "3.9"
services:
app:
build: .
image: linkshortener:latest
ports:
- "8080:8080"
env_file: .env
environment:
SPRING_PROFILES_ACTIVE: prod
DB_HOST: db
DB_PORT: "5432"
DB_NAME: url_shortener
SPRING_DATASOURCE_USERNAME: ${DB_USERNAME_PROD:-url_user}
SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD_PROD:-url_pass}
depends_on:
db:
condition: service_healthy
db:
image: postgres:16-alpine
container_name: linkshortener-db
environment:
POSTGRES_DB: url_shortener # must exist to avoid "database 'url_user' does not exist"
POSTGRES_USER: ${DB_USERNAME_PROD:-url_user}
POSTGRES_PASSWORD: ${DB_PASSWORD_PROD:-url_pass}
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME_PROD:-url_user} -d url_shortener"]
interval: 5s
timeout: 5s
retries: 10
volumes:
pgdata: