9.4 实例
services:
config-server:
image: 192.168.10.110:5000/config-server:0.0.1-SNAPSHOT
networks:
backend:
aliases:
- config-server
ports:
- "8071:8071"
environment:
encrypt.key: "123456789abcdef"
spring.profiles.active: "git"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:8071/actuator/health >> /dev/null && exit 0 || exit 1"]
interval: 1m30s
timeout: 30s
retries: 5
start_period: 10s
cloud-learning:
image: 192.168.10.110:5000/cloud-learning:0.0.1-SNAPSHOT
networks:
backend:
aliases:
- cloud-learning
ports:
- "8080:8080"
environment:
ENCRYPT_KEY: "fje83Ki8403Iod87dne7Yjsl3THueh48jfuO9j4U2hf64Lo"
SPRING_PROFILES_ACTIVE: "dev"
SPRING_CLOUD_CONFIG_URI: "http://config-server:8071"
depends_on:
config-server:
condition: service_healthy
networks:
backend:
driver: bridge
上述的Compose文件定义了两个service:config-server和cloud-learning。两者均是web端微服务,其中config-server是一个Spring Cloud Config Server,而cloud-learning是Config的客户端。


Last updated
Was this helpful?