目录
一、 docker-compose开启微服务
微服务是部署在docker里的,这里用docker-compose开启微服务。这里拿网关服务(服务名称:blade-gateway1和blade-gateway2)做例子,开启两个网关服务,然后在nginx里配置.
docker-compose文件配置
微服务打成镜像传至仓库,再从仓库拉去镜像到服务器的过程这里不描述。直接上docker-compose的配置,如下:
version: '3'
services:
blade-gateway1:
image: "${REGISTER}/blade-gateway:${TAG}"
environment:
- TZ=Asia/Shanghai
ports:
#8000是微服务本身的端口,81是映射的端口
- 81:8000
privileged: true
restart: always
networks:
blade_net:
ipv4_address: 172.30.0.81
blade-gateway2:
image: "${REGISTER}/blade-gateway:${TAG}"
environment:
- TZ=Asia/Shanghai
ports: