1+ version : ' 3.8'
2+
3+ services :
4+ # ----------------------------
5+ # 1. THE BRAIN (Eureka Server)
6+ # ----------------------------
7+ discovery-server :
8+ image : discovery-server:latest
9+ container_name : discovery-server
10+ build : ./discovery-server # Tells Docker where to find the Dockerfile
11+ ports :
12+ - " 8761:8761" # Maps Localhost:8761 -> Container:8761
13+ environment :
14+ - SPRING_APPLICATION_NAME=discovery-server
15+ networks :
16+ - microservices-net
17+
18+ # ----------------------------
19+ # 2. THE GATEKEEPER (API Gateway)
20+ # ----------------------------
21+ api-gateway :
22+ image : api-gateway:latest
23+ container_name : api-gateway
24+ build : ./api-gateway
25+ ports :
26+ - " 8080:8080" # This is the ONLY entry point for users
27+ environment :
28+ - SPRING_APPLICATION_NAME=api-gateway
29+ # The MAGIC: We tell it Eureka is at "http://discovery-server" (not localhost)
30+ - EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=http://discovery-server:8761/eureka/
31+ depends_on :
32+ - discovery-server
33+ networks :
34+ - microservices-net
35+
36+ # ----------------------------
37+ # 3. BOOKING SERVICE
38+ # ----------------------------
39+ booking-service :
40+ image : booking-service:latest
41+ container_name : booking-service
42+ build : ./booking-service
43+ ports :
44+ - " 8081:8080" # Optional: access directly via localhost:8081 if needed
45+ environment :
46+ - SPRING_APPLICATION_NAME=booking-service
47+ - EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=http://discovery-server:8761/eureka/
48+ depends_on :
49+ - discovery-server
50+ - api-gateway
51+ networks :
52+ - microservices-net
53+
54+ # ----------------------------
55+ # 4. EVENT SERVICE
56+ # ----------------------------
57+ event-service :
58+ image : event-service:latest
59+ container_name : event-service
60+ build : ./event-service
61+ ports :
62+ - " 8082:8080" # Optional: access directly via localhost:8082 if needed
63+ environment :
64+ - SPRING_APPLICATION_NAME=event-service
65+ - EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=http://discovery-server:8761/eureka/
66+ depends_on :
67+ - discovery-server
68+ - api-gateway
69+ networks :
70+ - microservices-net
71+
72+ # Create a shared network so they can talk to each other
73+ networks :
74+ microservices-net :
75+ driver : bridge
0 commit comments