Files
ApiGatewayTest/docker-compose.yaml

84 lines
2.0 KiB
YAML

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"
# KrakenD API Gateway (порт 8000)
api-gateway:
image: devopsfaith/krakend:latest
container_name: krakend-gateway
ports:
- "8000:8000"
volumes:
- ./krakend-config.json:/etc/krakend/configuration.json
environment:
- KRAKEND_LOG_LEVEL=INFO
networks:
- microservices-network
restart: unless-stopped
depends_on:
- service-1
- service-2
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
command: ["run", "-c", "/etc/krakend/configuration.json", "-d"]
labels:
service.type: "gateway"
service.name: "krakend-gateway"
service.port: "8000"
networks:
microservices-network:
driver: bridge
name: microservices-network