forked from ritik4ever/stellar-goal-vault
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
81 lines (77 loc) · 2.28 KB
/
Copy pathdocker-compose.yml
File metadata and controls
81 lines (77 loc) · 2.28 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
version: "3.9"
services:
backend:
build:
context: ./backend
container_name: stellar-goal-vault-backend
ports:
- "3001:3001"
env_file:
- ./backend/.env
restart: unless-stopped
healthcheck:
# Probe the backend REST API health endpoint.
# interval: how often Docker polls after the container starts.
# timeout: how long a single probe may take before it is considered failed.
# retries: consecutive failures before the container is marked unhealthy.
# start_period: grace window after container start before failures count.
test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
frontend:
build:
context: ./frontend
container_name: stellar-goal-vault-frontend
ports:
- "8080:8080"
environment:
- VITE_API_URL=/api
depends_on:
# Wait until the backend passes its health check before starting frontend.
backend:
condition: service_healthy
restart: unless-stopped
healthcheck:
# Probe the frontend HTTP server root.
# Same timing parameters as the backend for consistency.
test: ["CMD", "curl", "-f", "http://localhost:8080"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
nginx:
image: nginx:1.27-alpine
container_name: stellar-goal-vault-nginx
depends_on:
backend:
condition: service_healthy
frontend:
condition: service_healthy
ports:
- "8080:80"
- "8443:443"
volumes:
- ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf:ro
- nginx-certs:/etc/nginx/certs
command: >
/bin/sh -c "
if [ ! -f /etc/nginx/certs/dev.crt ]; then
apk add --no-cache openssl >/dev/null &&
openssl req -x509 -nodes -newkey rsa:2048 -days 365 \
-keyout /etc/nginx/certs/dev.key \
-out /etc/nginx/certs/dev.crt \
-subj '/CN=localhost';
fi;
nginx -g 'daemon off;'
"
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-check-certificate", "-q", "--spider", "https://localhost/api/health"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
volumes:
nginx-certs: