microservices example
This commit is contained in:
57
docker-compose.yaml
Normal file
57
docker-compose.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Service 1 - User Service (порт 8001)
|
||||
service-1:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.service1
|
||||
container_name: user-service
|
||||
ports:
|
||||
- "8001:8001"
|
||||
environment:
|
||||
- SERVICE_NAME=user-service
|
||||
- SERVICE_PORT=8001
|
||||
networks:
|
||||
- microservices-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
labels:
|
||||
service.type: "microservice"
|
||||
service.name: "user-service"
|
||||
service.port: "8001"
|
||||
|
||||
# Service 2 - Order Service (порт 8002)
|
||||
service-2:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.service2
|
||||
container_name: order-service
|
||||
ports:
|
||||
- "8002:8002"
|
||||
environment:
|
||||
- SERVICE_NAME=order-service
|
||||
- SERVICE_PORT=8002
|
||||
networks:
|
||||
- microservices-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8002/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
labels:
|
||||
service.type: "microservice"
|
||||
service.name: "order-service"
|
||||
service.port: "8002"
|
||||
|
||||
networks:
|
||||
microservices-network:
|
||||
driver: bridge
|
||||
name: microservices-network
|
||||
Reference in New Issue
Block a user