在micro源码目录新增plugins.go
package main
import (
_ "[github.com/micro/go-plugins/broker/nsq](http://github.com/micro/go-plugins/broker/nsq)"
_ "[github.com/micro/go-plugins/registry/etcd](http://github.com/micro/go-plugins/registry/etcd)"
)
编译成可执行文件
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' -I
打包成docker images
docker build -t ttouch/micro .
查看打包好的image并发布到docker hub
docker images
docker push ttouch/micro
启动api服务,并转发到rpc服务
docker run -d --link=etcd --name micro -p 8080:8080 -e MICRO_REGISTRY=etcd -e MICRO_REGISTRY_ADDRESS=http://etcd:2379 --restart=always ttouch/micro api --handler=rpc
进入micro,并查看当前服务信息
docker exec -it micro /bin/sh
./micro list services
网友评论