-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
89 lines (83 loc) · 2.55 KB
/
docker-compose.yml
File metadata and controls
89 lines (83 loc) · 2.55 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
services:
nginx:
image: nginx:1.27-alpine
container_name: tinyurl-nginx
depends_on:
backend:
condition: service_healthy
ports:
- "8080:80"
networks:
- public
- app_internal
volumes:
- ./infra/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1/actuator/health"]
interval: 15s
timeout: 5s
retries: 10
start_period: 10s
restart: unless-stopped
backend:
build:
context: ./tinyurl
dockerfile: Dockerfile
container_name: tinyurl-backend
depends_on:
postgres:
condition: service_healthy
environment:
SPRING_PROFILES_ACTIVE: dev
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/tinyurl
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME:?SPRING_DATASOURCE_USERNAME is required}
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD:?SPRING_DATASOURCE_PASSWORD is required}
SPRING_FLYWAY_USER: ${SPRING_FLYWAY_USER:?SPRING_FLYWAY_USER is required}
SPRING_FLYWAY_PASSWORD: ${SPRING_FLYWAY_PASSWORD:?SPRING_FLYWAY_PASSWORD is required}
SERVER_PORT: 8080
TINYURL_BASE_URL: http://localhost:8080
expose:
- "8080"
networks:
- app_internal
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8080/actuator/health"]
interval: 15s
timeout: 5s
retries: 10
start_period: 40s
restart: unless-stopped
postgres:
image: postgres:16-alpine
container_name: tinyurl-postgres
environment:
POSTGRES_DB: ${POSTGRES_DB:-tinyurl}
POSTGRES_USER: ${POSTGRES_USER:?POSTGRES_USER is required}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME:?SPRING_DATASOURCE_USERNAME is required}
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD:?SPRING_DATASOURCE_PASSWORD is required}
PGDATA: /var/lib/postgresql/data/pgdata
command:
- postgres
- -c
- max_connections=200
- -c
- shared_buffers=256MB
volumes:
- postgres-data:/var/lib/postgresql/data
- ./infra/postgres/init:/docker-entrypoint-initdb.d:ro
networks:
- app_internal
healthcheck:
test: ["CMD-SHELL", "pg_isready -U \"${POSTGRES_USER}\" -d \"${POSTGRES_DB:-tinyurl}\""]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
restart: unless-stopped
volumes:
postgres-data:
networks:
public:
app_internal:
internal: true