Skip to content

Commit

Permalink
[FAB-3208] Produce a container with fabric tools
Browse files Browse the repository at this point in the history
Currently cryptogen and configtxgen are used to generate fabric PKI and
configuration for peer and orderer. Adding these binaries inside of a
container might make it easier for developers since at times it can be a
little tricky with native binaries to connect to other running containers
(e.g. using Docker for Windows)

build : make tools-docker

clean : make tools-docker-clean

usage examples :

FABRIC_ROOT=$GOPATH/src/github.com/hyperledger/fabric/

docker run --rm -v $FABRIC_ROOT/examples/e2e_cli/:/etc/hyperledger/fabric \
hyperledger/fabric-tools configtxgen -profile TwoOrgsOrdererGenesis \
-outputBlock /etc/hyperledger/fabric/channel-artifacts/orderer.gen.blk

docker run --rm -v $FABRIC_ROOT/examples/e2e_cli/:/etc/hyperledger/fabric \
hyperledger/fabric-tools cryptogen generate \
--config=/etc/hyperledger/fabric/crypto-config.yaml

Change-Id: I04b7434a4db00168e1e3ce9f5b91336b92d1f304
Signed-off-by: Mathilde Ffrench <mathilde.ffrench@fr.ibm.com>
Signed-off-by: Greg Haskins <gregory.haskins@gmail.com>
  • Loading branch information
mffrench authored and ghaskins committed May 31, 2017
1 parent 5ba27bf commit 3084bb0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# - docker[-clean] - ensures all docker images are available[/cleaned]
# - peer-docker[-clean] - ensures the peer container is available[/cleaned]
# - orderer-docker[-clean] - ensures the orderer container is available[/cleaned]
# - tools-docker[-clean] - ensures the tools container is available[/cleaned]
# - protos - generate all protobuf artifacts based on .proto files
# - clean - cleans the build area
# - dist-clean - superset of 'clean' that also removes persistent state
Expand Down Expand Up @@ -81,7 +82,7 @@ GOSHIM_DEPS = $(shell ./scripts/goListFiles.sh $(PKGNAME)/core/chaincode/shim)
JAVASHIM_DEPS = $(shell git ls-files core/chaincode/shim/java)
PROTOS = $(shell git ls-files *.proto | grep -v vendor)
PROJECT_FILES = $(shell git ls-files)
IMAGES = peer orderer ccenv javaenv buildenv testenv zookeeper kafka couchdb
IMAGES = peer orderer ccenv javaenv buildenv testenv zookeeper kafka couchdb tools
RELEASE_PLATFORMS = windows-amd64 darwin-amd64 linux-amd64 linux-ppc64le linux-s390x
RELEASE_PKGS = configtxgen cryptogen

Expand Down Expand Up @@ -130,6 +131,8 @@ configtxgen: build/bin/configtxgen

cryptogen: build/bin/cryptogen

tools-docker: build/image/tools/$(DUMMY)

javaenv: build/image/javaenv/$(DUMMY)

buildenv: build/image/buildenv/$(DUMMY)
Expand Down Expand Up @@ -232,6 +235,10 @@ build/image/kafka/payload: images/kafka/docker-entrypoint.sh \
build/image/couchdb/payload: images/couchdb/docker-entrypoint.sh \
images/couchdb/local.ini \
images/couchdb/vm.args
build/image/tools/payload: build/docker/bin/cryptogen \
build/docker/bin/configtxgen \
build/docker/bin/peer \
build/sampleconfig.tar.bz2

build/image/%/payload:
mkdir -p $@
Expand Down
8 changes: 8 additions & 0 deletions images/tools/Dockerfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM _BASE_NS_/fabric-baseimage:_BASE_TAG_
ENV FABRIC_CFG_PATH /etc/hyperledger/fabric
VOLUME /etc/hyperledger/fabric
ADD payload/sampleconfig.tar.bz2 $FABRIC_CFG_PATH
COPY payload/cryptogen /usr/local/bin
COPY payload/configtxgen /usr/local/bin
COPY payload/peer /usr/local/bin

0 comments on commit 3084bb0

Please sign in to comment.