Skip to content

Commit

Permalink
[BUILD] Clean up MSP configuration
Browse files Browse the repository at this point in the history
Change-Id: I064999e6f24eedc6b57a36be67176e0cd79cf3b8
Signed-off-by: Greg Haskins <gregory.haskins@gmail.com>
  • Loading branch information
ghaskins committed Dec 12, 2016
1 parent 662b635 commit 5200fa1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
25 changes: 5 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ K := $(foreach exec,$(EXECUTABLES),\
GOSHIM_DEPS = $(shell ./scripts/goListFiles.sh $(PKGNAME)/core/chaincode/shim | sort | uniq)
JAVASHIM_DEPS = $(shell git ls-files core/chaincode/shim/java)
PROTOS = $(shell git ls-files *.proto | grep -v vendor)
MSP_SAMPLECONFIG = $(shell git ls-files msp/sampleconfig/*.pem)
PROJECT_FILES = $(shell git ls-files)
IMAGES = peer orderer ccenv javaenv testenv runtime

Expand Down Expand Up @@ -180,7 +181,8 @@ build/image/javaenv/payload: build/javashim.tar.bz2 \
build/protos.tar.bz2 \
settings.gradle
build/image/peer/payload: build/docker/bin/peer \
peer/core.yaml
peer/core.yaml \
build/msp-sampleconfig.tar.bz2
build/image/orderer/payload: build/docker/bin/orderer \
orderer/orderer.yaml
build/image/testenv/payload: build/gotools.tar.bz2
Expand All @@ -190,25 +192,7 @@ build/image/%/payload:
mkdir -p $@
cp $^ $@

# the target below is required to produce a valid
# local MSP config when we build the container; there
# might be a better way of structuring it, but we'll
# leave as a TODO for now
.PHONY: mspconfig
mspconfig: msp/sampleconfig/signcerts/peer.pem \
msp/sampleconfig/admincerts/admincert.pem \
msp/sampleconfig/keystore/key.pem \
msp/sampleconfig/cacerts/cacert.pem
mkdir -p build/image/peer/payload/msp/sampleconfig/signcerts
cp msp/sampleconfig/signcerts/peer.pem build/image/peer/payload/msp/sampleconfig/signcerts
mkdir -p build/image/peer/payload/msp/sampleconfig/admincerts
cp msp/sampleconfig/admincerts/admincert.pem build/image/peer/payload/msp/sampleconfig/admincerts
mkdir -p build/image/peer/payload/msp/sampleconfig/keystore
cp msp/sampleconfig/keystore/key.pem build/image/peer/payload/msp/sampleconfig/keystore
mkdir -p build/image/peer/payload/msp/sampleconfig/cacerts
cp msp/sampleconfig/cacerts/cacert.pem build/image/peer/payload/msp/sampleconfig/cacerts

build/image/%/$(DUMMY): Makefile build/image/%/payload mspconfig
build/image/%/$(DUMMY): Makefile build/image/%/payload
$(eval TARGET = ${patsubst build/image/%/$(DUMMY),%,${@}})
@echo "Building docker $(TARGET)-image"
@cat images/$(TARGET)/Dockerfile.in \
Expand All @@ -228,6 +212,7 @@ build/goshim.tar.bz2: $(GOSHIM_DEPS)

build/javashim.tar.bz2: $(JAVASHIM_DEPS)
build/protos.tar.bz2: $(PROTOS)
build/msp-sampleconfig.tar.bz2: $(MSP_SAMPLECONFIG)

build/%.tar.bz2:
@echo "Creating $@"
Expand Down
7 changes: 2 additions & 5 deletions images/peer/Dockerfile.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
FROM hyperledger/fabric-runtime:_TAG_
ENV PEER_CFG_PATH /etc/hyperledger/fabric
RUN mkdir -p /var/hyperledger/db $PEER_CFG_PATH/msp/sampleconfig/signcerts $PEER_CFG_PATH/msp/sampleconfig/admincerts $PEER_CFG_PATH/msp/sampleconfig/keystore $PEER_CFG_PATH/msp/sampleconfig/cacerts
RUN mkdir -p /var/hyperledger/db $PEER_CFG_PATH
COPY payload/peer /usr/local/bin
COPY payload/core.yaml $PEER_CFG_PATH
COPY payload/msp/sampleconfig/signcerts/peer.pem $PEER_CFG_PATH/msp/sampleconfig/signcerts
COPY payload/msp/sampleconfig/admincerts/admincert.pem $PEER_CFG_PATH/msp/sampleconfig/admincerts
COPY payload/msp/sampleconfig/keystore/key.pem $PEER_CFG_PATH/msp/sampleconfig/keystore
COPY payload/msp/sampleconfig/cacerts/cacert.pem $PEER_CFG_PATH/msp/sampleconfig/cacerts
ADD payload/msp-sampleconfig.tar.bz2 $PEER_CFG_PATH
CMD peer node start

0 comments on commit 5200fa1

Please sign in to comment.