一. X86编译

1. 安装zeromq库

根据setup script安装:

wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz
tar xvzf zeromq-4.2..tar.gz
cd zeromq-4.2.
./configure
sudo make install
sudo ldconfig
ldconfig -p | grep zmq
libzmq.so. (libc6,x86-) => /usr/local/lib/libzmq.so.
libzmq.so (libc6,x86-) => /usr/local/lib/libzmq.so export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/

2. 获取源码

go get github.com/edgexfoundry/edgex-go

3. 安装依赖包

edgex0.7.1采用glide管理go工程

$ glide install
[INFO] Lock file (glide.lock) does not exist. Performing update.
[INFO] Downloading dependencies. Please wait...
[INFO] --> Fetching updates for github.com/BurntSushi/toml
[INFO] --> Fetching updates for github.com/eclipse/paho.mqtt.golang
[INFO] --> Fetching updates for github.com/stretchr/testify
[INFO] --> Fetching updates for github.com/hashicorp/consul
[INFO] --> Fetching updates for github.com/docker/docker
[INFO] --> Fetching updates for github.com/gorilla/mux
[INFO] --> Fetching updates for github.com/docker/go-units
[INFO] --> Fetching updates for github.com/go-zoo/bone
[INFO] --> Fetching updates for github.com/docker/go-connections
[INFO] --> Fetching updates for github.com/mitchellh/consulstructure
[INFO] --> Fetching updates for github.com/pelletier/go-toml
[INFO] --> Fetching updates for github.com/pebbe/zmq4
[INFO] --> Fetching updates for github.com/robfig/cron
[INFO] --> Fetching updates for gopkg.in/mgo.v2
[INFO] --> Fetching updates for gopkg.in/yaml.v2
[INFO] --> Fetching updates for github.com/mattn/go-xmpp
[INFO] --> Fetching updates for github.com/satori/go.uuid
[INFO] --> Fetching updates for github.com/magiconair/properties
[INFO] --> Fetching updates for github.com/docker/distribution
[INFO] --> Fetching updates for github.com/gomodule/redigo
[INFO] --> Setting version for github.com/mattn/go-xmpp to e543ad3fcd51155e4b39f7487bdfcb5e3772f1ce.
[INFO] --> Setting version for github.com/docker/docker to b1116479b23434de7d70710b6454af7cb2484a58.
[INFO] --> Setting version for github.com/docker/go-connections to 97c2040d34dfae1d1b1275fa3a78dbdd2f41cf7e.
[INFO] --> Setting version for github.com/docker/go-units to 47565b4f722fb6ceae66b95f853feed578a4a51c.
[INFO] --> Setting version for github.com/BurntSushi/toml to a368813c5e648fee92e5f6c30e3944ff9d5e8895.
[INFO] --> Setting version for github.com/mitchellh/consulstructure to b407c521973b7b902db2f09e65dbf5cb10f2dc5f.
[INFO] --> Setting version for github.com/docker/distribution to 16128bbac47f75050e82f7e91b04df33775e0c23.
[INFO] --> Setting version for github.com/go-zoo/bone to 9eaad4b99a9a66b85c0cc32cb9691621ccfa4278.
[INFO] --> Detected semantic version. Setting version for github.com/pelletier/go-toml to v1.2.0
[INFO] --> Detected semantic version. Setting version for github.com/hashicorp/consul to v1.1.0
[INFO] --> Detected semantic version. Setting version for github.com/stretchr/testify to v1.2.1
[INFO] --> Detected semantic version. Setting version for github.com/gorilla/mux to v1.3.0
[INFO] --> Detected semantic version. Setting version for github.com/pebbe/zmq4 to v1.0.0
[INFO] --> Detected semantic version. Setting version for github.com/robfig/cron to v1.1.0
[INFO] --> Detected semantic version. Setting version for github.com/gomodule/redigo to v2.0.0
[INFO] --> Detected semantic version. Setting version for github.com/magiconair/properties to v1.8.0
[INFO] --> Detected semantic version. Setting version for github.com/satori/go.uuid to v1.2.0
[INFO] --> Detected semantic version. Setting version for github.com/eclipse/paho.mqtt.golang to v1.1.1
[INFO] --> Setting version for gopkg.in/mgo.v2 to 3f83fa5005286a7fe593b055f0d7771a7dce4655.
[INFO] --> Setting version for gopkg.in/yaml.v2 to eb3733d160e74a9c7e442f435eb3bea458e1d19f.
[INFO] Resolving imports
[INFO] --> Fetching updates for github.com/gorilla/context
[INFO] --> Fetching updates for github.com/davecgh/go-spew
[INFO] --> Fetching updates for github.com/pmezard/go-difflib
[INFO] --> Fetching updates for github.com/stretchr/objx
[INFO] --> Fetching golang.org/x/net/proxy
[WARN] Unable to checkout golang.org/x/net/proxy
[ERROR] Error looking for golang.org/x/net/proxy: Cannot detect VCS
[INFO] --> Fetching golang.org/x/net/websocket
[WARN] Unable to checkout golang.org/x/net/websocket
[ERROR] Error looking for golang.org/x/net/websocket: Cannot detect VCS
[INFO] --> Fetching updates for github.com/influxdata/influxdb
[INFO] --> Fetching updates for github.com/hashicorp/go-cleanhttp
[INFO] --> Fetching updates for github.com/hashicorp/go-rootcerts
[INFO] --> Fetching updates for github.com/hashicorp/serf
[INFO] --> Fetching updates for github.com/cenkalti/backoff
[INFO] --> Fetching updates for github.com/mitchellh/copystructure
[INFO] --> Fetching updates for github.com/mitchellh/mapstructure
[INFO] --> Fetching updates for github.com/opencontainers/go-digest
[INFO] --> Fetching updates for github.com/pkg/errors
[INFO] --> Fetching golang.org/x/net/context/ctxhttp
[WARN] Unable to checkout golang.org/x/net/context/ctxhttp
[ERROR] Error looking for golang.org/x/net/context/ctxhttp: Cannot detect VCS
[ERROR] Error scanning github.com/influxdata/influxdb/client/v2: cannot find package "." in:
/home/wang/.glide/cache/src/https-github.com-influxdata-influxdb/client/v2
[INFO] --> Fetching updates for github.com/mitchellh/go-homedir
[INFO] --> Fetching updates for github.com/armon/go-metrics
[INFO] --> Fetching updates for github.com/mitchellh/reflectwalk
[INFO] --> Fetching updates for github.com/opencontainers/image-spec
[INFO] --> Fetching updates for github.com/Microsoft/go-winio
[WARN] Unable to set version on golang.org/x/net/proxy to . Err: Cannot detect VCS
[INFO] --> Fetching updates for github.com/hashicorp/go-immutable-radix
[INFO] --> Fetching updates for github.com/gogo/protobuf
[INFO] --> Fetching golang.org/x/sys/windows
[WARN] Unable to checkout golang.org/x/sys/windows
[ERROR] Error looking for golang.org/x/sys/windows: Cannot detect VCS
[INFO] --> Fetching updates for github.com/hashicorp/golang-lru
[WARN] Unable to set version on golang.org/x/sys/windows to . Err: Cannot detect VCS
[ERROR] Failed to retrieve a list of dependencies: Error resolving imports

提取如下依赖包错误:

golang.org/x/net/proxy
golang.org/x/net/websocket
golang.org/x/net/context/ctxhttp
golang.org/x/sys/windows

glide搜索到的包应该以git或svn等vcs,但上述proxy、websocket和ctxhttp是net的子包,golang.org/x/net/采用git管理。同样,golang.org/x/sys采用git管理,windows是sys的子目录。此时,可在glide.yaml中指定golang.org/x/net和golang.org/x/sys的子包关系:

- package: golang.org/x/net
subpackages:
- proxy
- websocket
- context/ctxhttp
- package: golang.org/x/sys
subpackages:
- windows

此时,直接设置git管理包的镜像即可,mirror设置:

glide mirror set https://golang.org/x/net https://github.com/golang/net --vcs git
glide mirror set golang.org/x/sys https://github.com/golang/sys --vcs git

此时,glide install成功执行。

注:若安装的依赖包出现错误,可能是包版本不对,需要在glide.yaml中指定软件包的版本(如master中已不包含原来的目录,导致包检索依赖不成功,github.com/influxdata/influxdb/client/v2最新版没有client目录)。

edgex1.0.1采用GO111MODULE管理

首先确保go版本在1.11之上,golang从1.11开始内置module管理功能。

由于golang.org被墙,需要在go.mod中增加替换:

replace (
bitbucket.org/bertimus9/systemstat => github.com/sigma/systemstat v0.0.0--0eeff89b0690
golang.org/x/crypto => github.com/golang/crypto v0.0.0--45a5f77698d3
golang.org/x/net => github.com/golang/net v0.0.0--351d144fa1fc
golang.org/x/sync => github.com/golang/sync v0.0.0--37e7f081c4d4
golang.org/x/sys => github.com/golang/sys v0.0.0--95b1ffbd15a5
golang.org/x/tools => github.com/golang/tools v0.0.0--4b1f3b6b1646
)

4. 编译

make prepare
make build

5. 启动mongodb,然后直接运行make run即可。

在自目录保存数据,如/home/wang/edgex/db。

sudo mongod --dbpath "/home/wang/edgex/db"
mongo init_mongo.js
sudo mongod --dbpath "/home/wang/edgex/db" --shutdown
sudo chown -R mongodb:mongodb "/home/wang/edgex/db"
sudo mongod --dbpath "/home/wang/edgex/db" --auth
sudo mongod --dbpath "/home/wang/edgex/db" --bind_ip_all ;允许远程访问数据库

make run

若运行报错,可能是mongo权限问题,去除--auth。

6.  测试随机数设备

参考4.3.1. Writing a Device Service in Go编译随机数简单设备,运行device-simple可执行文件。

若不报错,且数据一直上报,可通过如下地址查询数据:

http://localhost:48080/api/v1/event/device/RandNum-Device01/100

http://172.61.1.125:48080/api/v1/event
http://172.61.1.125:48071/api/v1/registration
http://172.61.1.125:48080/api/v1/event/count
http://172.61.1.125:48080/api/v1/valuedescriptor
http://172.61.1.125:48081/api/v1/device
http://172.61.1.125:48081/api/v1/deviceservice

可注册mosquitto云平台,上传至云平台:

POST to http://192.168.134.144:48071/api/v1/registration
{"name":"MyMQTTTopic","addressable":{"name":"MyMQTTBroker","protocol":"TCP","address":"192.168.134.144","port":,"publisher":"EdgeXExportPublisher","user":"wang","password":"mypass","topic":"a/b/c"},"format":"JSON","enable":true,"destination":"MQTT_TOPIC"}

在主机192.168.134.144上开启mosquitto,并:

$ mosquitto_sub -t a/b/c
{"id":"5cecfb6d902d0f90ade77aca","pushed":,"device":"RandNum-Device01","created":,"modified":,"origin":,"schedule":null,"event":null,"readings":[{"id":"5cecfb6d902d0f90ade77acb","pushed":,"created":,"origin":,"modified":,"device":"RandNum-Device01","name":"Random","value":""}]}

二. 交叉编译

在Ubuntu16.04上交叉编译edgex 1.0.1,编译后的程序运行于OKMX6DL-S3(Cortex-A9,32位,双核)。

2.1 交叉编译工具链

板卡自带交叉编译工具链应用

. /opt/fsl-imx-x11/4.1.-2.1./environment-setup-cortexa9hf-neon-poky-linux-gnueabi
/opt/fsl-imx-x11/4.1.-2.1./sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
/opt/fsl-imx-x11/4.1.-2.1./sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++

通用交叉编译工具链应用

sudo apt-get install g++--arm-linux-gnueabihf g++--arm-linux-gnueabihf
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc- --slave /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-

注:板卡自带交叉编译工具链编译edgex不成功,随采用通用交叉编译工具链。

2.2 交叉编译zeromq

板卡自带交叉编译工具链应用

./configure --prefix=/home/wang/edgex/edgex_mx6dl/zeromq-4.2./winstall --host=arm-poky-linux-gnueabi  CC="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=$SDKTARGETSYSROOT -mfloat-abi=hard" CXX="/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ --sysroot=$SDKTARGETSYSROOT -mfloat-abi=hard "
make && make install

通用交叉编译工具链应用

./configure --prefix=/home/wang/edgex/edgex_mx6dl/zeromq-4.2./winstall --host=arm-poky-linux-gnueabi  CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++
make && make install

2.3 交叉编译edgex

采用通用交叉编译器编译edgex,解决包依赖关系后,修改Makefile中编译选项:

GO=GOARCH=arm CGO_ENABLED= GO111MODULE=on go
GOCGO=GOARCH=arm CGO_ENABLED= CC="arm-linux-gnueabihf-gcc" \
CGO_CFLAGS="-I/home/wang/edgex/edgex_mx6dl/zeromq-4.2.2/winstall/include" CGO_LDFLAGS="-L/home/wang/edgex/edgex_mx6dl/zeromq-4.2.2/winstall/lib -lzmq" \
GO111MODULE=on go

然后执行如下命令编译

make build

将生成的zeromq库文件winstall,edgex生成的bin和cmd,及mongodb编译而成的bin(mongodb自编译有问题,从网上下载2.6.4版本可执行文件)拷贝到板卡并安装。

先启动mongodb,然后执行edgex,同X86上运行顺序,可正确执行并运行。

三. docker镜像制作

生成所有docker可运行命令:

make docker

生成单独docker可运行命令(以docker_export_distro为例):

make docker_export_distro

docker_export_distro:
docker build \
-f cmd/export-distro/Dockerfile \
--label "git_sha=$(GIT_SHA)" \
-t edgexfoundry/docker-export-distro-go:$(GIT_SHA) \
-t edgexfoundry/docker-export-distro-go:$(DOCKER_TAG) \
.

Dockerfile文件如下:

#
# Copyright (c) -
# Mainflux
# Cavium
#
# SPDX-License-Identifier: Apache-2.0
# FROM golang:1.11-alpine AS builder ENV GO111MODULE=on
WORKDIR /go/src/github.com/edgexfoundry/edgex-go # The main mirrors are giving us timeout issues on builds periodically.
# So we can try these. RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/repositories RUN apk update && apk add zeromq-dev libsodium-dev pkgconfig build-base git COPY go.mod .
#COPY go.sum . RUN go mod download COPY . .
RUN make cmd/export-distro/export-distro FROM alpine LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2017-2018: Mainflux, Cavium' # The main mirrors are giving us timeout issues on builds periodically.
# So we can try these. RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/repositories RUN apk --no-cache add zeromq
COPY --from=builder /go/src/github.com/edgexfoundry/edgex-go/cmd/export-distro/Attribution.txt /
COPY --from=builder /go/src/github.com/edgexfoundry/edgex-go/cmd/export-distro/export-distro /
COPY --from=builder /go/src/github.com/edgexfoundry/edgex-go/cmd/export-distro/res/docker/configuration.toml /res/docker/configuration.toml
ENTRYPOINT ["/export-distro","--registry","--profile=docker","--confdir=/res"]

上述命令生成两个镜像(其中一个在cache中,另一个为实际镜像,两个tag),没有容器产生(docker ps -a不显示,容器被删除):

export-distro容器镜像生成日志:

make docker_export_distro
docker build \
-f cmd/export-distro/Dockerfile \
--label "git_sha=48146ead559bd9f27e80af344e3cf787530a1539" \
-t edgexfoundry/docker-export-distro-go:48146ead559bd9f27e80af344e3cf787530a1539 \
-t edgexfoundry/docker-export-distro-go:1.0.-dev \
.
Sending build context to Docker daemon 161MB
Step / : FROM golang:1.11-alpine AS builder
---> e116d2efa2ab
Step / : ENV GO111MODULE=on
---> Using cache
---> 6f17441d1946
Step / : WORKDIR /go/src/github.com/edgexfoundry/edgex-go
---> Using cache
---> 1e94eec59dac
Step / : RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/reposi tories
---> Using cache
---> 48697136fcca
Step / : RUN apk update && apk add zeromq-dev libsodium-dev pkgconfig build-base git
---> Running in bea28e9e5eb1
fetch http://nl.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://nl.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
v3.10.3--g2fd4d3cdac [http://nl.alpinelinux.org/alpine/v3.10/main]
v3.10.3--g8068beb776 [http://nl.alpinelinux.org/alpine/v3.10/community]
OK: distinct packages available
(/) Installing binutils (2.32-r0)
(/) Installing libmagic (5.37-r1)
(/) Installing file (5.37-r1)
(/) Installing gmp (6.1.-r1)
(/) Installing isl (0.18-r0)
(/) Installing libgomp (8.3.-r0)
(/) Installing libatomic (8.3.-r0)
(/) Installing libgcc (8.3.-r0)
(/) Installing mpfr3 (3.1.-r1)
(/) Installing mpc1 (1.1.-r0)
(/) Installing libstdc++ (8.3.-r0)
(/) Installing gcc (8.3.-r0)
(/) Installing musl-dev (1.1.-r3)
(/) Installing libc-dev (0.7.-r0)
(/) Installing g++ (8.3.-r0)
(/) Installing make (4.2.-r2)
(/) Installing fortify-headers (1.1-r0)
(/) Installing build-base (0.5-r1)
(/) Installing nghttp2-libs (1.39.-r0)
(/) Installing libcurl (7.66.-r0)
(/) Installing expat (2.2.-r0)
(/) Installing pcre2 (10.33-r0)
(/) Installing git (2.22.-r0)
(/) Installing libsodium (1.0.-r0)
(/) Installing pkgconf (1.6.-r1)
(/) Installing libsodium-dev (1.0.-r0)
(/) Installing libzmq (4.3.-r1)
(/) Installing zeromq-dev (4.3.-r1)
Executing busybox-1.30.-r2.trigger
OK: MiB in packages
Removing intermediate container bea28e9e5eb1
---> 650c39be3c34
Step / : COPY go.mod .
---> 3afaf7b13163
Step / : RUN go mod download
---> Running in ca37635ae857
go: finding github.com/stretchr/testify v1.3.0
go: finding github.com/BurntSushi/toml v0.3.1
go: finding github.com/edgexfoundry/go-mod-core-contracts v0.1.0
go: finding github.com/ugorji/go v1.1.4
go: finding github.com/vektra/mockery v0.0.0--e78b021dcbb5
go: finding github.com/imdario/mergo v0.3.6
go: finding github.com/pkg/errors v0.8.1
go: finding github.com/edgexfoundry/go-mod-registry v0.1.0
go: finding github.com/OneOfOne/xxhash v1.2.5
go: finding bitbucket.org/bertimus9/systemstat v0.0.0--0eeff89b0690
go: finding github.com/hashicorp/consul v1.4.2
go: finding github.com/magiconair/properties v1.8.0
go: finding github.com/gorilla/mux v1.7.0
go: finding github.com/go-stack/stack v1.8.0
go: finding github.com/hashicorp/go-cleanhttp v0.5.0
go: finding github.com/gorilla/context v1.1.1
go: finding github.com/robfig/cron v0.0.0--b41be1df6967
go: finding github.com/stretchr/testify v1.2.2
go: finding github.com/mitchellh/go-testing-interface v1.0.0
go: finding github.com/go-kit/kit v0.8.0
go: finding github.com/globalsign/mgo v0.0.0--eeefdecb41b8
go: finding github.com/golang/tools v0.0.0--4b1f3b6b1646
go: finding github.com/gomodule/redigo v2.0.0+incompatible
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/stretchr/objx v0.1.0
go: finding github.com/go-logfmt/logfmt v0.4.0
go: finding github.com/mitchellh/mapstructure v1.1.2
go: finding github.com/edgexfoundry/go-mod-messaging v0.1.8
go: finding github.com/eclipse/paho.mqtt.golang v1.1.1
go: finding github.com/mattn/go-xmpp v0.0.0--6093f50721ed
go: finding github.com/hashicorp/serf v0.8.2
go: finding github.com/cenkalti/backoff v2.1.1+incompatible
go: finding github.com/pebbe/zmq4 v1.0.0
go: finding github.com/hashicorp/go-rootcerts v1.0.0
go: finding gopkg.in/yaml.v2 v2.2.2
go: finding gopkg.in/eapache/queue.v1 v1.1.0
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/mitchellh/copystructure v1.0.0
go: finding github.com/google/uuid v1.1.0
go: finding github.com/pelletier/go-toml v1.2.0
go: finding github.com/mitchellh/go-homedir v1.0.0
go: finding github.com/mitchellh/consulstructure v0.0.0--56fdc4d2da54
go: finding github.com/stretchr/objx v0.1.1
go: finding github.com/kr/logfmt v0.0.0--b84e30acd515
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/hashicorp/go-syslog v1.0.0
go: finding github.com/hashicorp/memberlist v0.1.3
go: finding github.com/hashicorp/mdns v1.0.0
go: finding github.com/mitchellh/reflectwalk v1.0.0
go: finding github.com/mitchellh/mapstructure v0.0.0--ca63d7c062ee
go: finding github.com/mitchellh/cli v1.0.0
go: finding github.com/armon/go-metrics v0.0.0--f0300d1749da
go: finding github.com/golang/net v0.0.0--9b4f9f5ad519
go: finding github.com/ryanuber/columnize v0.0.0--9b3edd62028f
go: finding github.com/hashicorp/go-msgpack v0.5.3
go: finding github.com/miekg/dns v1.0.14
go: finding github.com/mitchellh/gox v0.4.0
go: finding gopkg.in/check.v1 v0.0.0--20d25e280405
go: finding github.com/posener/complete v1.1.1
go: finding github.com/google/btree v0.0.0--4030bb1f1f0c
go: finding github.com/hashicorp/go-immutable-radix v1.0.0
go: finding github.com/hashicorp/go-multierror v1.0.0
go: finding github.com/hashicorp/go-uuid v1.0.1
go: finding github.com/mitchellh/iochan v1.0.0
go: finding github.com/mattn/go-isatty v0.0.3
go: finding github.com/bgentry/speakeasy v0.1.0
go: finding github.com/hashicorp/errwrap v1.0.0
go: finding github.com/hashicorp/go.net v0.0.1
go: finding github.com/armon/go-radix v0.0.0--7fddfc383310
go: finding github.com/hashicorp/go-uuid v1.0.0
go: finding github.com/hashicorp/logutils v1.0.0
go: finding github.com/pascaldekloe/goe v0.0.0--57f6aae5913c
go: finding github.com/mattn/go-colorable v0.0.9
go: finding github.com/hashicorp/golang-lru v0.5.0
go: finding github.com/hashicorp/go-sockaddr v1.0.0
go: finding github.com/sean-/seed v0.0.0--e2103e2c3529
go: finding github.com/golang/sys v0.0.0--95b1ffbd15a5
go: finding github.com/golang/sync v0.0.0--37e7f081c4d4
go: finding github.com/golang/crypto v0.0.0--45a5f77698d3
go: finding github.com/fatih/color v1.7.0
go: finding github.com/armon/circbuf v0.0.0--bbbad097214e
Removing intermediate container ca37635ae857
---> 2ea018099509
Step / : COPY . .
---> 84ba3cac05ec
Step / : RUN make cmd/export-distro/export-distro
---> Running in 8a604a3ff538
CGO_ENABLED= GO111MODULE=on go build -ldflags "-X github.com/edgexfoundry/edgex-go.Version=1.0.2" -o cmd/export-distro/export-distro ./cmd/export-distro
Removing intermediate container 8a604a3ff538
---> baee083043d1
Step / : FROM alpine
---> 965ea09ff2eb
Step / : LABEL license='SPDX-License-Identifier: Apache-2.0' copyright='Copyright (c) 201 7-2018: Mainflux, Cavium'
---> Running in a01ad4abfdfb
Removing intermediate container a01ad4abfdfb
---> 62e4c99a09a5
Step / : RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/repositories
---> Running in 42ead2d3a8ae
Removing intermediate container 42ead2d3a8ae
---> bb1077aa9c15
Step / : RUN apk --no-cache add zeromq
---> Running in aca49fd6b908
fetch http://nl.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://nl.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(/) Installing libgcc (8.3.-r0)
(/) Installing libsodium (1.0.-r0)
(/) Installing libstdc++ (8.3.-r0)
(/) Installing libzmq (4.3.-r1)
(/) Installing zeromq (4.3.-r1)
Executing busybox-1.30.-r2.trigger
OK: MiB in packages
Removing intermediate container aca49fd6b908
---> 87d4d892ce45
Step / : COPY --from=builder /go/src/github.com/edgexfoundry/edgex-go/cmd/export-distro/Attribu tion.txt /
---> fb0838b3634e
Step / : COPY --from=builder /go/src/github.com/edgexfoundry/edgex-go/cmd/export-distro/export- distro /
---> cbc71f92b1a8
Step / : COPY --from=builder /go/src/github.com/edgexfoundry/edgex-go/cmd/export-distro/res/doc ker/configuration.toml /res/docker/configuration.toml
---> 249eb2415b09
Step / : ENTRYPOINT ["/export-distro","--registry","--profile=docker","--confdir=/res"]
---> Running in 3ce321e2bbc9
Removing intermediate container 3ce321e2bbc9
---> a9e2f471715a
Step / : LABEL git_sha=48146ead559bd9f27e80af344e3cf787530a1539
---> Running in 4d218e19c2ba
Removing intermediate container 4d218e19c2ba
---> 67b4d76a7d45
Successfully built 67b4d76a7d45
Successfully tagged edgexfoundry/docker-export-distro-go:48146ead559bd9f27e80af344e3cf787530a1539
Successfully tagged edgexfoundry/docker-export-distro-go:1.0.-dev

edinburgh_1.0.2

注:生成其他docker镜像时,都会使用cache中镜像(repository和tag都是<none>),编译一次供多个容器使用。可以通过docker tag保留容器。

docker tag baee083043d1 edgex_mid1:first

 make docker_core_data
docker build \
-f cmd/core-data/Dockerfile \
--label "git_sha=48146ead559bd9f27e80af344e3cf787530a1539" \
-t edgexfoundry/docker-core-data-go:48146ead559bd9f27e80af344e3cf787530a1539 \
-t edgexfoundry/docker-core-data-go:1.0.-dev \
.
Sending build context to Docker daemon 161MB
Step / : FROM golang:1.11-alpine AS builder
---> e116d2efa2ab
Step / : ENV GO111MODULE=on
---> Using cache
---> 6f17441d1946
Step / : WORKDIR /go/src/github.com/edgexfoundry/edgex-go
---> Using cache
---> 1e94eec59dac
Step / : RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/repositories
---> Using cache
---> 48697136fcca
Step / : RUN apk update && apk add zeromq-dev libsodium-dev pkgconfig build-base git
---> Using cache
---> 650c39be3c34
Step / : COPY go.mod .
---> Using cache
---> 3afaf7b13163
Step / : RUN go mod download
---> Using cache
---> 2ea018099509
Step / : COPY . .
---> 2f43fc26cea8
Step / : RUN make cmd/core-data/core-data
---> Running in c4f567e254ba
CGO_ENABLED= GO111MODULE=on go build -ldflags "-X github.com/edgexfoundry/edgex-go.Version=1.0.2" -o cmd/core-data/core-data ./cmd/core-data
Removing intermediate container c4f567e254ba
---> 3f47fb78be86
Step / : FROM alpine
---> 965ea09ff2eb
Step / : LABEL license='SPDX-License-Identifier: Apache-2.0' copyright='Copyright (c) 2018: Dell, Cavium'
---> Running in 0df73306b0d5
Removing intermediate container 0df73306b0d5
---> 2ab515094063
Step / : RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/repositories
---> Running in db0db60625d5
Removing intermediate container db0db60625d5
---> ccfa3db0f47e
Step / : RUN apk --no-cache add zeromq
---> Running in 236dcf9889df
fetch http://nl.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://nl.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(/) Installing libgcc (8.3.-r0)
(/) Installing libsodium (1.0.-r0)
(/) Installing libstdc++ (8.3.-r0)
(/) Installing libzmq (4.3.-r1)
(/) Installing zeromq (4.3.-r1)
Executing busybox-1.30.-r2.trigger
OK: MiB in packages
Removing intermediate container 236dcf9889df
---> 01425d9e6bf4
Step / : COPY --from=builder /go/src/github.com/edgexfoundry/edgex-go/cmd/core-data/Attribution.txt /
---> 31a9a4020f22
Step / : COPY --from=builder /go/src/github.com/edgexfoundry/edgex-go/cmd/core-data/core-data /
---> 732b0fa69f65
Step / : COPY --from=builder /go/src/github.com/edgexfoundry/edgex-go/cmd/core-data/res/docker/configuration.toml /res/docker/configuration.toml
---> 7ed81604d03f
Step / : ENTRYPOINT ["/core-data","--registry","--profile=docker","--confdir=/res"]
---> Running in dde57cf9df93
Removing intermediate container dde57cf9df93
---> 1dbe1e5529bf
Step / : LABEL git_sha=48146ead559bd9f27e80af344e3cf787530a1539
---> Running in f88f03b51cd0
Removing intermediate container f88f03b51cd0
---> 3ad0508f7ee4
Successfully built 3ad0508f7ee4
Successfully tagged edgexfoundry/docker-core-data-go:48146ead559bd9f27e80af344e3cf787530a1539
Successfully tagged edgexfoundry/docker-core-data-go:1.0.-dev

edinburgh_1.0.2_core-data

参考:

1.在树莓派3b+上运行edgex

2.  4.2.2.1. Get EdgeX Foundry - Go Developers

3. 4.3.1. Writing a Device Service in Go

4. 4.3.2. Writing a Device Service in C

最新文章

  1. .Net调用R语言
  2. 使用XAMPP创建本地浏览器经验
  3. Flink - state
  4. 1034. Head of a Gang (30)
  5. atitit.GMT UTC Catitit.GMT UTC CST DST CET 星期 月份 节日 时间的不同本质and起源
  6. mac vim 使用
  7. Javascript 笔记与总结(1-1)作用域
  8. CDH hive的安装
  9. FlashBuilder(FB/eclipse) 打开多个无效
  10. 读:HIS 与医保系统的接入方案及实现
  11. Educational Codeforces Round 7 E. Ants in Leaves 贪心
  12. makefile 中 $@ $^ %&lt; 使用
  13. Nginx 独立图片服务器的搭建
  14. C# 非public的方法和属性的单元测试
  15. CentOS6.8系统下,ecipse下进行编辑操作,意外退出
  16. 修改文件MD5值
  17. Android 添加第三方jar包
  18. 剑指offer-栈的压入与弹出
  19. bzoj千题计划193:bzoj2460: [BeiJing2011]元素
  20. vue父与子通信

热门文章

  1. Python3基础 tuple list转为tuple
  2. Django文档阅读之执行原始SQL查询
  3. [03]Go设计模式:工厂模式(Factory Pattern)
  4. python is 和 == 区别(8)
  5. pymysql 模块简单使用
  6. REST-framework之频率组件
  7. SpringCloud之Ribbon负载均衡及Feign消费者调用服务
  8. springboot项目 配置https
  9. resnet的理解-- 面试笔记
  10. Window 使用Nginx 部署 Vue 并把nginx设为windows服务开机自动启动