diff --git a/Makefile b/Makefile index 5b4b8808d9e..8ca6273d1f9 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,7 @@ K := $(foreach exec,$(EXECUTABLES),\ SUBDIRS = gotools sdk/node SUBDIRS:=$(strip $(SUBDIRS)) +GOSHIM_DEPS = $(shell ./scripts/goListFiles.sh github.com/hyperledger/fabric/core/chaincode/shim | sort | uniq) JAVASHIM_DEPS = $(shell git ls-files core/chaincode/shim/java) PROJECT_FILES = $(shell git ls-files) IMAGES = src ccenv peer membersrvc javaenv @@ -192,7 +193,7 @@ build/image/src/.dummy: $(PROJECT_FILES) @touch $@ # Special override for ccenv-image (chaincode-environment) -build/image/ccenv/.dummy: build/image/src/.dummy build/image/ccenv/bin/protoc-gen-go build/image/ccenv/bin/chaintool Makefile +build/image/ccenv/.dummy: build/image/ccenv/bin/protoc-gen-go build/image/ccenv/bin/chaintool build/image/ccenv/goshim.tar.bz2 Makefile @echo "Building docker ccenv-image" @cat images/ccenv/Dockerfile.in \ | sed -e 's/_BASE_TAG_/$(BASE_DOCKER_TAG)/g' \ @@ -234,6 +235,10 @@ build/image/%/.dummy: build/image/src/.dummy build/docker/bin/% docker tag $(PROJECT_NAME)-$(TARGET) $(PROJECT_NAME)-$(TARGET):$(DOCKER_TAG) @touch $@ +%/goshim.tar.bz2: $(GOSHIM_DEPS) Makefile + @echo "Creating $@" + @tar -jhc -C $(GOPATH)/src $(patsubst $(GOPATH)/src/%,%,$(GOSHIM_DEPS)) > $@ + .PHONY: protos protos: gotools ./devenv/compile_protos.sh diff --git a/images/ccenv/Dockerfile.in b/images/ccenv/Dockerfile.in index ef05564cf2c..27d764f7f35 100644 --- a/images/ccenv/Dockerfile.in +++ b/images/ccenv/Dockerfile.in @@ -1,2 +1,3 @@ -FROM hyperledger/fabric-src:_TAG_ +FROM hyperledger/fabric-baseimage:_BASE_TAG_ COPY bin/* /usr/local/bin/ +ADD goshim.tar.bz2 $GOPATH/src/ diff --git a/scripts/goListFiles.sh b/scripts/goListFiles.sh new file mode 100755 index 00000000000..13730e7878d --- /dev/null +++ b/scripts/goListFiles.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +target=$1 + +deps=`go list -f '{{ join .Deps "\n" }}' $target` + +find $GOPATH/src/$target -type f + +for dep in $deps; +do + importpath=$GOPATH/src/$dep + if [ -d $importpath ]; + then + find $importpath -type f + fi +done