Skip to content

Commit ee471b6

Browse files
g2flyermbrandenburger
authored andcommitted
Docker related changes
* enable containers (and related scripts) to be optionally SGX_MODE aware and run in HW mode iff SGX_MODE=HW * also some dockerfile cleanup Signed-off-by: michael steiner <[email protected]>
1 parent 13a2097 commit ee471b6

File tree

23 files changed

+227
-108
lines changed

23 files changed

+227
-108
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323
- SGX_MODE=SIM
2424
- SGX_SDK=/opt/intel/sgxsdk
2525
# SGX SSL
26-
- OPENSSL=1.1.0j
26+
- OPENSSL_VERSION=1.1.0j
2727
- SGXSSL_VERSION=v2.4.1
2828
- SGXSSL=/opt/intel/sgxssl
2929
# NANOPB
@@ -51,8 +51,8 @@ before_install:
5151
- chmod +x ${SGX_SDK_BIN}
5252
- sudo sh -c "echo 'yes' | ./${SGX_SDK_BIN}"; popd
5353
# SGX SSL
54-
- pushd $HOME; git clone --branch $SGXSSL_VERSION https://github.com/intel/intel-sgx-ssl.git
55-
- wget https://www.openssl.org/source/openssl-$OPENSSL.tar.gz; mv openssl-$OPENSSL.tar.gz intel-sgx-ssl/openssl_source
54+
- pushd $HOME; git clone --branch ${SGXSSL_VERSION} https://github.com/intel/intel-sgx-ssl.git
55+
- wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz; mv openssl-${OPENSSL_VERSION}.tar.gz intel-sgx-ssl/openssl_source
5656
- cd intel-sgx-ssl/Linux; make SGX_MODE=SIM DESTDIR=$SGXSSL all test
5757
- cd intel-sgx-ssl/Linux; make install; popd
5858
# NANOPB

demo/README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,20 @@ Below is the script's help text.
5353
```
5454
startFPCAuctionNetwork.sh [options]
5555
56-
This script, by default, will teardown possible previous iterations of this demo, generate new
57-
crypto material for the network, start an FPC network as defined in $FPC_PATH/utils/docker-compose,
58-
install the mock golang auction chaincode($FPC_PATH/demo/chaincode/golang), install the FPC
59-
compliant auction chaincode($FPC_PATH/demo/chaincode/fpc), register auction users, and bring up
60-
both the fabric-gatway & frontend UI. If the fabric-gateway and frontend UI docker images have
61-
not previously been built it will build them, otherwise the script will reuse the images already
62-
existing. The FPC chaincode will not be built unless specified by the flag --build-cc.
63-
By calling the script with both build options, you will be able to run the demo without having
64-
to build the whole FPC project (e.g., by calling `make` in $FPC_PATH).
56+
This script, by default, will teardown possible previous iterations of this
57+
demo, generate new crypto material for the network, start an FPC network as
58+
defined in \$FPC_PATH/utils/docker-compose, install the mock golang auction
59+
chaincode(\$FPC_PATH/demo/chaincode/golang), install the FPC compliant
60+
auction chaincode(\$FPC_PATH/demo/chaincode/fpc), register auction users,
61+
and bring up both the fabric-gatway & frontend UI.
62+
63+
If the fabric-gateway and frontend UI docker images have not previously been
64+
built it will build them, otherwise the script will reuse the images already
65+
existing. You can force a rebuild, though, by specifying the flag
66+
--build-client. The FPC chaincode will not be built unless specified by the
67+
flag --build-cc. By calling the script with both build options, you will be
68+
able to run the demo without having to build the whole FPC project (e.g., by
69+
calling `make` in $FPC_PATH).
6570
6671
options:
6772
--build-cc:
@@ -95,8 +100,10 @@ will delete all the unused volumes and chaincode images.
95100

96101
### Scripting
97102

98-
To facilitate demonstrations and also to help in testing, you can specify a scenario script defining the
99-
actions of the different parties and execute it using the command [scenario-run.sh](client/scripting/scenario-run.sh).
103+
To facilitate demonstrations and also to help in testing, you can specify with a simple
104+
[DSL](client/scripting/lib/dsl.sh) a scenario script defining the
105+
actions of the different parties and execute it using the command
106+
[scenario-run.sh](client/scripting/scenario-run.sh).
100107
Below is the script's help text.
101108
```
102109
scenario-run.sh [--help|-h|-?] [--bootstrap|-b] [--dry-run|-d] [--non-interactive|-n] [--skip-delay|-s] [--mock-reset|-r] <script-file>

demo/chaincode/fpc/Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,21 @@ build: $(BUILD_DIR)
2828
clean:
2929
-rm -rf $(BUILD_DIR)
3030

31+
32+
HW_EXTENSION=$(shell if [ "${SGX_MODE}" = "HW" ]; then echo "-hw"; fi)
33+
34+
FPC_DOCKER_NAMESPACE := hyperledger/fabric-private-chaincode
35+
FPC_DOCKER_CC_BUILDER_NAME = $(FPC_DOCKER_NAMESPACE)-cc-builder$(HW_EXTENSION)
36+
3137
docker-build: clean
32-
$(DOCKER) image inspect hyperledger/fabric-private-chaincode-cc-builder > /dev/null 2>&1 || { cd $(TOP)/utils/docker && make cc-builder; }
33-
$(DOCKER) run -u $$(id -u):$$(id -g) -v ${PWD}:/project/src/github.com/hyperledger-labs/fabric-private-chaincode/demo/chaincode/fpc -w /project/src/github.com/hyperledger-labs/fabric-private-chaincode/demo/chaincode/fpc hyperledger/fabric-private-chaincode-cc-builder sh -c 'make build'
38+
$(DOCKER) image inspect $(FPC_DOCKER_CC_BUILDER_NAME) > /dev/null 2>&1 \
39+
|| { cd $(TOP)/utils/docker && make cc-builder; }
40+
$(DOCKER) run \
41+
-u $$(id -u):$$(id -g)\
42+
-v ${PWD}:/project/src/github.com/hyperledger-labs/fabric-private-chaincode/demo/chaincode/fpc\
43+
-w /project/src/github.com/hyperledger-labs/fabric-private-chaincode/demo/chaincode/fpc\
44+
$(FPC_DOCKER_CC_BUILDER_NAME)\
45+
sh -c 'make build'
3446

3547
test: build
3648
./test.sh

demo/client/frontend/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ public/img/users/c-mobile.svg:
6666

6767

6868
clobber:
69+
RUNNING_IMAGE=$$(${DOCKER} ps -q --filter ancestor=${DOCKER_IMAGE}); \
70+
if [ ! -z "$${RUNNING_IMAGE}" ]; then ${DOCKER} kill $${RUNNING_IMAGE}; fi
6971
IMAGE=$$(${DOCKER} images ${DOCKER_IMAGE} -q); \
70-
if [ ! -z "$${IMAGE}" ]; then ${DOCKER} rmi ${IMAGE}; fi
72+
if [ ! -z "$${IMAGE}" ]; then ${DOCKER} rmi -f $${IMAGE}; fi
7173
# make clobber in demo/ also would take care but better safe than sorry
7274
-$(RM) $(AVATAR_FILES)

demo/client/scripting/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ${GO_CMDS}: ${GO_CMDS:=.go}
1414
$(GO) build $@.go
1515

1616
test: build
17-
./scenario-run.sh --bootstrap --non-interactive ../../scenario/script
17+
./scenario-run.sh --bootstrap --non-interactive ../../scenario/script
1818

1919
clean:
2020
$(GO) $@

demo/scripts/startFPCAuctionNetwork.sh

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,32 @@ set -e
1111
help(){
1212
echo "$(basename $0) [options]
1313
14-
This script, by default, will teardown possible previous iterations of this demo, generate new
15-
crypto material for the network, start an FPC network as defined in \$FPC_PATH/utils/docker-compose,
16-
install the mock golang auction chaincode(\$FPC_PATH/demo/chaincode/golang), install the FPC
17-
compliant auction chaincode(\$FPC_PATH/demo/chaincode/fpc), register auction users, and bring up
18-
both the fabric-gatway & frontend UI. If the fabric-gateway and frontend UI docker images have
19-
not previously been built it will build them, otherwise the script will reuse the images already
20-
existing. The FPC chaincode will not be built unless specified by the flag --build-cc.
14+
This script, by default, will teardown possible previous iterations of this
15+
demo, generate new crypto material for the network, start an FPC network as
16+
defined in \$FPC_PATH/utils/docker-compose, install the mock golang auction
17+
chaincode(\$FPC_PATH/demo/chaincode/golang), install the FPC compliant
18+
auction chaincode(\$FPC_PATH/demo/chaincode/fpc), register auction users,
19+
and bring up both the fabric-gatway & frontend UI.
20+
21+
If the fabric-gateway and frontend UI docker images have not previously been
22+
built it will build them, otherwise the script will reuse the images already
23+
existing. You can force a rebuild, though, by specifying the flag
24+
--build-client. The FPC chaincode will not be built unless specified by the
25+
flag --build-cc. By calling the script with both build options, you will be
26+
able to run the demo without having to build the whole FPC project (e.g., by
27+
calling 'make' in \$FPC_PATH).
2128
2229
options:
2330
--build-cc:
24-
As part of bringing up the demo components, the auction cc in demo/chaincode/fpc will
25-
be rebuilt using the docker-build make target.
31+
As part of bringing up the demo components, the auction cc in
32+
demo/chaincode/fpc will be rebuilt using the docker-build make target.
2633
--build-client:
27-
As part of bringing up the demo components, the Fabric Gateway and the UI docker images
28-
will be built or rebuilt using current source code.
34+
As part of bringing up the demo components, the Fabric Gateway and
35+
the UI docker images will be built or rebuilt using current source
36+
code.
2937
--help,-h:
3038
Print this help screen.
31-
"
39+
"
3240
}
3341

3442

@@ -75,7 +83,7 @@ if $BUILD_CHAINCODE; then
7583
echo ""
7684
echo "Building FPC Auction Chaincode"
7785
pushd ${DEMO_ROOT}/chaincode/fpc
78-
make docker-build
86+
make SGX_MODE=${SGX_MODE} docker-build
7987
popd
8088
fi
8189

ecc/Dockerfile.boilerplate-ecc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ ARG CC_NAME="ecc"
88
ARG CC_PATH="/usr/local/bin"
99
ARG CC_LIB_PATH=${CC_PATH}"/enclave/lib"
1010

11+
ARG SGX_MODE
12+
ENV SGX_MODE=${SGX_MODE}
13+
# Note: the library copied below is SGX_MODE dependent, so we
14+
# define here a env which makes it easy recognizable which mode
15+
# the container is. No default, though, as we do not control
16+
# the build and rely on a proper value provided from outside.
17+
18+
1119
RUN mkdir -p ${CC_LIB_PATH}
1220

1321
ENV SGX_SDK=/opt/intel/sgxsdk

ecc/Dockerfile.fpc-app

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
FROM hyperledger/fabric-private-chaincode-boilerplate-ecc
5+
ARG BOILERPLATE_EXTENSION
6+
7+
FROM hyperledger/fabric-private-chaincode-boilerplate-ecc${BOILERPLATE_EXTENSION}
68

79
ARG enclave_so_path
810
ARG CC_PATH="/usr/local/bin"

ecc/Makefile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ VSCC_OUT = ecc-vscc.so
1616
DOCKER_CONTAINER_ID?=$$(docker ps | grep -- ${NET_ID}-${PEER_ID}-$(CC_NAME)- | awk '{print $$1;}')
1717
# the following are the required docker build parameters
1818
DOCKER_IMAGE ?= $$(docker images | grep -- ${NET_ID}-${PEER_ID}-$(CC_NAME)- | awk '{print $$1;}')
19-
DOCKER_BOILERPLATE_ECC_IMAGE ?= hyperledger/$(PROJECT_NAME)-boilerplate-ecc
19+
BOILERPLATE_EXTENSION=$(shell if [ "${SGX_MODE}" = "HW" ]; then echo "-hw"; fi)
20+
DOCKER_BOILERPLATE_ECC_IMAGE ?= hyperledger/$(PROJECT_NAME)-boilerplate-ecc$(BOILERPLATE_EXTENSION)
2021
INSTALLED_DOCKER_BOILERPLATE_ECC_IMAGE ?= $$(docker images | grep -- ${DOCKER_BOILERPLATE_ECC_IMAGE} | awk '{print $$1;}')
2122
DOCKER_ENCLAVE_SO_PATH ?= $(ENCLAVE_SO_PATH)
2223

@@ -71,21 +72,29 @@ ifdef FORCE_REBUILD
7172
endif
7273

7374
docker-boilerplate-ecc: ecc
74-
$(DOCKER) build $(DOCKER_BUILD_OPTS) -t $(DOCKER_BOILERPLATE_ECC_IMAGE) -f Dockerfile.boilerplate-ecc ..
75+
$(DOCKER) build $(DOCKER_BUILD_OPTS) -t $(DOCKER_BOILERPLATE_ECC_IMAGE) -f Dockerfile.boilerplate-ecc\
76+
--build-arg SGX_MODE=$(SGX_MODE)\
77+
..
7578

7679
docker-fpc-app: docker-boilerplate-ecc
7780
if [ -z "$(DOCKER_IMAGE)" ]; then\
7881
echo "\033[0;31mERROR: cannot override $(CC_NAME) docker image - not found\033[0m";\
7982
exit 1;\
8083
fi
8184
echo "\033[1;33mWARNING: overriding $(DOCKER_IMAGE) docker image\033[0m"
82-
$(DOCKER) build $(DOCKER_BUILD_OPTS) -t $(DOCKER_IMAGE) -f Dockerfile.fpc-app --build-arg enclave_so_path=$(DOCKER_ENCLAVE_SO_PATH) ..
85+
$(DOCKER) build $(DOCKER_BUILD_OPTS) -t $(DOCKER_IMAGE) -f Dockerfile.fpc-app \
86+
--build-arg BOILERPLATE_EXTENSION=$(BOILERPLATE_EXTENSION)\
87+
--build-arg enclave_so_path=$(DOCKER_ENCLAVE_SO_PATH)\
88+
..
8389

8490
docker-run:
91+
if [ "$(SGX_MODE)" = "HW" ]; then \
92+
SGX_DEVICE_PATH=$(if [ -e "/dev/isgx" ]; then echo "/dev/isgx"; elif [ -e "/dev/sgx" ]; then echo "/dev/sgx"; else echo "ERROR: NO SGX DEVICE FOUND"; fi);\
93+
DOCKER_SGX_ARGS="--device $${SGX_DEVICE_PATH} -v /var/run/aesmd:/var/run/aesmd";\
94+
fi;\
8595
$(DOCKER) run \
8696
-it \
87-
--device /dev/isgx \
88-
-v /var/run/aesmd:/var/run/aesmd \
97+
$${DOCKER_SGX_ARGS} \
8998
--name $(CC_NAME) \
9099
-e "CORE_CHAINCODE_LOGGING_LEVEL=DEBUG" \
91100
-e "CORE_CHAINCODE_LOGGING_SHIM=INFO" \

fabric/bin/peer.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ FPC_TOP_DIR="${SCRIPTDIR}/../../"
1010
FABRIC_SCRIPTDIR="${FPC_TOP_DIR}/fabric/bin/"
1111

1212
: ${FABRIC_CFG_PATH:=$(pwd)}
13+
: ${SGX_MODE:=SIM}
1314

1415
. ${FABRIC_SCRIPTDIR}/lib/common_utils.sh
1516
. ${FABRIC_SCRIPTDIR}/lib/common_ledger.sh
@@ -69,7 +70,7 @@ handle_chaincode_install() {
6970
DOCKER_IMAGE_NAME=$(${FPC_DOCKER_NAME_CMD} --cc-name ${FPC_NAME} --cc-version ${CC_VERSION} --net-id ${NET_ID} --peer-id ${PEER_ID}) || die "could not get docker image name"
7071

7172
# install docker
72-
try make ENCLAVE_SO_PATH=${CC_ENCLAVESOPATH} DOCKER_IMAGE=${DOCKER_IMAGE_NAME} -C ${FPC_TOP_DIR}/ecc docker-fpc-app
73+
try make SGX_MODE=${SGX_MODE} ENCLAVE_SO_PATH=${CC_ENCLAVESOPATH} DOCKER_IMAGE=${DOCKER_IMAGE_NAME} -C ${FPC_TOP_DIR}/ecc docker-fpc-app
7374

7475
# eplace path and lang arg with dummy go chaincode
7576
ARGS_EXEC=( 'chaincode' 'install' '-n' "${FPC_NAME}" '-v' "${CC_VERSION}" '-p' 'github.com/hyperledger/fabric/examples/chaincode/go/example02/cmd' "${OTHER_ARGS[@]}" )

utils/docker-compose/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ is used. Otherwise it will use `core.yaml` and the regular peer image.
3333
```
3434
This will create all necessary installation artifacts and start the
3535
network.
36+
If your environment variable `SGX_MODE` is set to hardware, the network will run
37+
the peer also with SGX hardware mode enabled, otherwise it will run in SGX simulation mode.
3638
If you set the environment variable `USE_EXPLORER` to `true`, the network will include
3739
and start the [Hyperledger Explorer](https://www.hyperledger.org/projects/explorer) on
3840
[port 8090](http://localhost:8090). This will enable you to inspect the networks,

utils/docker-compose/network-config/base/base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# `/project/src/github.com/hyperledger-labs/fabric-private-chaincode/fabric/bin/peer.sh`
1717

1818
#
19-
version: '2'
19+
version: '2.1'
2020

2121
services:
2222
peer-base:

utils/docker-compose/network-config/docker-compose-couchdb.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# docker-compose-"delta" to docker-compose.yaml to run peer with couchdb
66

7-
version: '2'
7+
version: '2.1'
88

99
services:
1010
couchdb0.org1.example.com:

utils/docker-compose/network-config/docker-compose-explorer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Note: this is a tweaked version of './docker-compose.yaml' in hyperledger/blockchain-explorer.git
55

66
# SPDX-License-Identifier: Apache-2.0
7-
version: '2'
7+
version: '2.1'
88

99
volumes:
1010
pgdata:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright Intel Corp. All Rights Reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# docker-compose-"delta" to docker-compose.yaml to run peer with SGX in HW Mode
6+
7+
version: '2.1'
8+
9+
services:
10+
peer0.org1.example.com:
11+
# ideally we would extend the definition of 'peer-base:' but alas docker-compose
12+
# doesn't propagate this to services which 'extend' from peer-base :-(
13+
image: hyperledger/fabric-peer-fpc-hw
14+
# build:
15+
# args:
16+
# SGX_MODE: HW
17+
volumes:
18+
- ${SGX_CONFIG_ROOT:-../../../config/ias/}:/project/src/github.com/hyperledger-labs/fabric-private-chaincode/config/ias/
19+
- /var/run/aesmd:/var/run/aesmd
20+
devices:
21+
- ${SGX_DEVICE_PATH:-/dev/isgx}:${SGX_DEVICE_PATH:-/dev/isgx}
22+
environment:
23+
- SGX_MODE=HW
24+

utils/docker-compose/network-config/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
#
2222
#
23-
version: '2'
23+
version: '2.1'
2424

2525
networks:
2626
basic:

utils/docker-compose/scripts/lib/common.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ export PATH=${SCRIPT_DIR}/../bin:${PWD}:$PATH
1010
export FABRIC_CFG_PATH=${SCRIPT_DIR}/../network-config
1111
export FPC_PATH="${FPC_PATH:-${SCRIPT_DIR}/../../..}"
1212

13+
# SGX mode: make sure it is set so we consistently use the same value also when we call make
14+
# Note: make might define in config*.mk its own value without necessarily it being an env variable
15+
export SGX_MODE=${SGX_MODE:=SIM}
16+
1317
# Variables which we allow the caller override ..
1418
export FABRIC_VERSION=${FABRIC_VERSION:=1.4.3}
1519
export CHANNEL_NAME=${CHANNEL_NAME:=mychannel}
@@ -21,6 +25,7 @@ export MSYS_NO_PATHCONV=1
2125

2226
# defaults for services used
2327
export USE_FPC=${USE_FPC:=true}
28+
export USE_SGX_HW=$(if [ "${SGX_MODE}" = "HW" ]; then echo true; else echo false; fi)
2429
export USE_COUCHDB=${USE_COUCHDB:=false}
2530
export USE_EXPLORER=${USE_EXPLORER:=false}
2631

@@ -40,10 +45,15 @@ export COMPOSE_PROJECT_NAME="fabric$(echo ${FPC_CONFIG} | sed 's/[^a-zA-Z0-9]//g
4045

4146
export DOCKER_COMPOSE_CMD="docker-compose"
4247
export DOCKER_COMPOSE_OPTS="${DOCKER_COMPOSE_OPTS:+${DOCKER_COMPOSE_OPTS} }-f ${NETWORK_CONFIG}/docker-compose.yml"
43-
if $USE_COUCHDB; then
48+
if ${USE_COUCHDB}; then
4449
export DOCKER_COMPOSE_OPTS="${DOCKER_COMPOSE_OPTS} -f ${NETWORK_CONFIG}/docker-compose-couchdb.yml"
4550
fi
46-
if $USE_EXPLORER; then
51+
if ${USE_EXPLORER}; then
4752
export DOCKER_COMPOSE_OPTS="${DOCKER_COMPOSE_OPTS} -f ${NETWORK_CONFIG}/docker-compose-explorer.yml"
4853
fi
54+
if ${USE_SGX_HW}; then
55+
SGX_DEVICE_PATH=$(if [ -e "/dev/isgx" ]; then echo "/dev/isgx"; elif [ -e "/dev/sgx" ]; then echo "/dev/sgx"; else echo "ERROR: NO SGX DEVICE FOUND"; fi)
56+
export DOCKER_COMPOSE_CMD="env SGX_DEVICE_PATH=${SGX_DEVICE_PATH} SGX_CONFIG_ROOT="${FPC_PATH}/config/ias" ${DOCKER_COMPOSE_CMD}"
57+
export DOCKER_COMPOSE_OPTS="${DOCKER_COMPOSE_OPTS} -f ${NETWORK_CONFIG}/docker-compose-sgx-hw.yml"
58+
fi
4959
export DOCKER_COMPOSE="${DOCKER_COMPOSE_CMD} ${DOCKER_COMPOSE_OPTS}"

utils/docker-compose/scripts/start.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ export SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && p
1616
#
1717
if [[ ! $USE_FPC = false ]]; then
1818
# - existance of FPC peer
19-
FPC_PEER_NAME="hyperledger/fabric-peer-fpc"
19+
FPC_PEER_NAME="hyperledger/fabric-peer-fpc$(if [ "${SGX_MODE}" = "HW" ]; then echo "-hw"; fi)"
2020
if [ -z "$(docker images | grep ${FPC_PEER_NAME})" ]; then
2121
echo "FPC peer container image '${FPC_PEER_NAME}' does not exist, try to build it ..."
2222
# if it doesn't exist, build it: note this can take quite some time!!
2323
pushd "${FPC_PATH}/utils/docker" || die "can't go to peer build location"
24-
make peer || die "can't build peer"
24+
make SGX_MODE=${SGX_MODE} peer || die "can't build peer"
2525
popd
2626
fi
2727
# - existance of boilerplate
28-
BOILERPLATE_NAME="hyperledger/fabric-private-chaincode-boilerplate-ecc"
28+
BOILERPLATE_NAME="hyperledger/fabric-private-chaincode-boilerplate-ecc$(if [ "${SGX_MODE}" = "HW" ]; then echo "-hw"; fi)"
2929
if [ -z "$(docker images | grep ${BOILERPLATE_NAME})" ]; then
3030
echo "FPC boilerplate container image '${BOILERPLATE_NAME}' does not exist, try to build it ..."
3131
pushd "${FPC_PATH}/" || die "can't go to fpc-sdk and boilerplate build location"
32-
make fpc-sdk || die "can't build fpc sdk"
32+
make SGX_MODE=${SGX_MODE} fpc-sdk || die "can't build fpc sdk"
3333
popd
3434
pushd "${FPC_PATH}/utils/docker" || die "can't go to docker build location"
35-
make || die "can't build docker base images"
35+
make SGX_MODE=${SGX_MODE} || die "can't build docker base images"
3636
popd
3737
pushd "${FPC_PATH}/ecc" || die "can't go to fpc-sdk and boilerplate build location"
38-
make docker-boilerplate-ecc || die "can't build boilerplate"
38+
make SGX_MODE=${SGX_MODE} docker-boilerplate-ecc || die "can't build boilerplate"
3939
popd
4040
fi
4141
fi

0 commit comments

Comments
 (0)