version: "3.9" services: app: image: igs170911/reaction:v1.0.4 container_name: app-service ports: - "8080:8080" # 替換為您的應用服務的公開端口 depends_on: - mongo - etcd - redis environment: MONGO_URI: mongodb://mongo:27017/appdb ETCD_ENDPOINT: http://etcd:2379 REDIS_HOST: redis REDIS_PORT: 6379 networks: - app-network mongo: image: mongo:8.0 container_name: mongo restart: always ports: - "27017:27017" environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: example networks: - app-network volumes: - mongo-data:/data/db etcd: image: quay.io/coreos/etcd:v3.5.5 container_name: etcd restart: always command: > /usr/local/bin/etcd --data-dir=/etcd-data --name=etcd --listen-client-urls=http://0.0.0.0:2379 --advertise-client-urls=http://etcd:2379 ports: - "2379:2379" - "2380:2380" networks: - app-network volumes: - etcd-data:/etcd-data redis: image: redis:7.0 container_name: redis restart: always ports: - "6379:6379" networks: - app-network volumes: - redis-data:/data networks: app-network: driver: bridge volumes: mongo-data: etcd-data: redis-data: