version: '3' services:e tyapi_etcd: image: bitnami/etcd container_name: tyapi_etcd environment: - TZ=Asia/Shanghai - ALLOW_NONE_AUTHENTICATION=yes - ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379 ports: - "2379:2379" networks: - tyapi_network restart: always tyapi_etcdManage: image: evildecay/etcdkeeper container_name: tyapi_etcdManage environment: - TZ=Asia/Shanghai depends_on: - tyapi_etcd ports: - "7000:8080" # 将容器的8080端口映射到宿主机的7000端口,便于web访问 networks: - tyapi_network restart: always tyapi_zookeeper: image: wurstmeister/zookeeper container_name: tyapi_zookeeper ports: - "2181:2181" networks: - tyapi_network restart: always tyapi_kafka: image: wurstmeister/kafka container_name: tyapi_kafka ports: - "9092:9092" environment: KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 KAFKA_ZOOKEEPER_CONNECT: tyapi_zookeeper:2181 volumes: - /var/run/docker.sock:/var/run/docker.sock networks: - tyapi_network restart: always tyapi_redis: image: redis:7.4.0 container_name: tyapi_redis ports: - "6379:6379" networks: - tyapi_network restart: always tyapi_mysql: image: mysql:8.0.34 container_name: tyapi_mysql environment: - MYSQL_ROOT_PASSWORD=rootpassword - MYSQL_DATABASE=tianyuanapi - MYSQL_USER=tianyuanapi - MYSQL_PASSWORD=g3h98u0291j ports: - "3307:3306" volumes: - mysql_data:/var/lib/mysql networks: - tyapi_network restart: always tyapi_gateway: container_name: tyapi_gateway build: context: . dockerfile: ./apps/gateway/Dockerfile ports: - "10001:10001" environment: - ENV=production depends_on: - tyapi_etcd - tyapi_redis - tyapi_mysql - tyapi_user - tyapi_sentinel networks: - tyapi_network restart: always tyapi_admin: container_name: tyapi_admin build: context: . dockerfile: ./apps/admin/Dockerfile ports: - "10002:10002" environment: - ENV=production depends_on: - tyapi_etcd - tyapi_redis - tyapi_mysql - tyapi_user - tyapi_sentinel networks: - tyapi_network restart: always tyapi_api: container_name: tyapi_api build: context: . dockerfile: ./apps/api/Dockerfile ports: - "10003:10003" environment: - ENV=production depends_on: - tyapi_etcd - tyapi_redis - tyapi_mysql - tyapi_user - tyapi_sentinel - tyapi_mqs - tyapi_kafka networks: - tyapi_network restart: always tyapi_mqs: container_name: tyapi_mqs build: context: . dockerfile: ./apps/mqs/Dockerfile environment: - ENV=production ports: - "12001:12001" depends_on: - tyapi_kafka - tyapi_etcd - tyapi_redis - tyapi_user - tyapi_sentinel networks: - tyapi_network restart: always tyapi_sentinel: container_name: tyapi_sentinel build: context: . dockerfile: ./apps/sentinel/Dockerfile environment: - ENV=production depends_on: - tyapi_redis - tyapi_mysql - tyapi_etcd ports: - "11002:11002" networks: - tyapi_network restart: always tyapi_user: container_name: tyapi_user build: context: . dockerfile: ./apps/user/Dockerfile environment: - ENV=production ports: - "11001:11001" depends_on: - tyapi_mysql - tyapi_redis - tyapi_etcd networks: - tyapi_network restart: always volumes: mysql_data: driver: local networks: tyapi_network: driver: bridge