-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
136 lines (128 loc) · 3.88 KB
/
docker-compose.yml
File metadata and controls
136 lines (128 loc) · 3.88 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
version: "3.9"
# ─────────────────────────────────────────────────────────────
# Green API Workshop — Docker Compose
# Devoxx France 2026 — Tools in Action
# ─────────────────────────────────────────────────────────────
services:
# ── Baseline API (naïve, port 8080) ──────────────────────
baseline:
build:
context: ./green-api-baseline
dockerfile: Dockerfile
ports:
- "8080:8080"
environment:
- SERVER_PORT=8080
- JAVA_TOOL_OPTIONS=-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0 -XX:+ExitOnOutOfMemoryError -Xms256m -Xmx1536m
deploy:
resources:
limits:
memory: 4g
reservations:
memory: 1g
stop_grace_period: 10s
restart: on-failure:5
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
interval: 10s
timeout: 5s
retries: 10
start_period: 60s
networks:
- green-net
# ── Optimized API (port 8081) ────────────────────────────
optimized:
build:
context: ./green-api-optimized
dockerfile: Dockerfile
ports:
- "8081:8081"
depends_on:
baseline:
condition: service_healthy
environment:
- SERVER_PORT=8081
- JAVA_TOOL_OPTIONS=-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0 -XX:+ExitOnOutOfMemoryError -Xms256m -Xmx1536m
deploy:
resources:
limits:
memory: 4g
reservations:
memory: 1g
stop_grace_period: 10s
restart: on-failure:5
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/actuator/health"]
interval: 10s
timeout: 5s
retries: 10
start_period: 60s
networks:
- green-net
# ── Dashboard (nginx, port 3000) ─────────────────────────
dashboard:
image: nginx:alpine
ports:
- "3000:80"
volumes:
- ./dashboard:/dashboard
- ./dashboard:/usr/share/nginx/html
- ./reports:/usr/share/nginx/html/reports
depends_on:
- baseline
- optimized
networks:
- green-net
# ── Analyzer (one-shot, generates report) ────────────────
# ── Analyzer WITH DISCOVERY (one-shot, swagger-driven) ──
analyzer-discovery:
image: bash:devel-alpine3.23 #curlimages/curl:latest
depends_on:
baseline:
condition: service_healthy
optimized:
condition: service_healthy
volumes:
- ./dashboard:/dashboard
- ./scripts:/scripts
- ./reports:/reports
- ./.spectral.yml:/.spectral.yml
entrypoint: ["sh", "-c"]
command:
- |
apk add --no-cache bash python3 coreutils > /dev/null 2>&1
BASELINE_PORT=8080 OPTIMIZED_PORT=8081 bash /scripts/green-score-analyzer_withdiscovery_docker.sh
environment:
- BASELINE_PORT=8080
- OPTIMIZED_PORT=8081
networks:
- green-net
profiles:
- discovery
# ── Auto-Discover Analyzer (one-shot, swagger-driven) ───
auto-discover:
image: python:3.12-slim
depends_on:
baseline:
condition: service_healthy
optimized:
condition: service_healthy
volumes:
- .:/workspace
working_dir: /workspace
entrypoint: ["python3"]
command:
- scripts/green-api-auto-discover.py
- --target
- http://optimized:8081
- --repeat
- "3"
environment:
- PYTHONDONTWRITEBYTECODE=1
networks:
- green-net
profiles:
- auto-discover
networks:
green-net:
driver: bridge