From 134549af22135775524fbe105ccc4471abc99aeb Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Sat, 22 Jul 2017 16:58:14 -0400 Subject: [PATCH] FAB-5412 add fabric-preload.sh script Add a script to allow users to preload the Fabric docker images without having to run the curl command in the RTD. Change-Id: I3b6c682c3e2ab1f230f7af8c3ce0b95bbb8fd024 Signed-off-by: Christopher Ferris --- scripts/README.md | 10 ++++++++++ scripts/fabric-preload.sh | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 scripts/README.md create mode 100755 scripts/fabric-preload.sh diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000000..4dce8de6a8 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,10 @@ +## Hyperledger Fabric Samples + +fabric-preload.sh will preload all of the requisite docker images for Hyperledger Fabric and tag them +with the 'latest' tag. Optionally, specify a specific version (e.g. 1.0.1). Default version is 1.0.0. + +```bash +./fabric-preload.sh [version] +``` + +Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License diff --git a/scripts/fabric-preload.sh b/scripts/fabric-preload.sh new file mode 100755 index 0000000000..a88963ed80 --- /dev/null +++ b/scripts/fabric-preload.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +export VERSION=${1:-1.0.0} +export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') +#Set MARCH variable i.e ppc64le,s390x,x86_64,i386 +MARCH=`uname -m` + +dockerFabricPull() { + local FABRIC_TAG=$1 + for IMAGES in peer orderer couchdb ccenv javaenv kafka zookeeper tools; do + echo "==> FABRIC IMAGE: $IMAGES" + echo + docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG + docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES + done +} + +dockerCaPull() { + local CA_TAG=$1 + echo "==> FABRIC CA IMAGE" + echo + docker pull hyperledger/fabric-ca:$CA_TAG + docker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca +} + +: ${CA_TAG:="$MARCH-$VERSION"} +: ${FABRIC_TAG:="$MARCH-$VERSION"} + +echo "===> Pulling fabric Images" +dockerFabricPull ${FABRIC_TAG} + +echo "===> Pulling fabric ca Image" +dockerCaPull ${CA_TAG} +echo +echo "===> List out hyperledger docker images" +docker images | grep hyperledger* +