Skip to content

Commit 134549a

Browse files
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 <chrisfer@us.ibm.com>
1 parent a7e83fc commit 134549a

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

scripts/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Hyperledger Fabric Samples
2+
3+
fabric-preload.sh will preload all of the requisite docker images for Hyperledger Fabric and tag them
4+
with the 'latest' tag. Optionally, specify a specific version (e.g. 1.0.1). Default version is 1.0.0.
5+
6+
```bash
7+
./fabric-preload.sh [version]
8+
```
9+
10+
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>

scripts/fabric-preload.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
#
3+
# Copyright IBM Corp. All Rights Reserved.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
export VERSION=${1:-1.0.0}
9+
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)}')
10+
#Set MARCH variable i.e ppc64le,s390x,x86_64,i386
11+
MARCH=`uname -m`
12+
13+
dockerFabricPull() {
14+
local FABRIC_TAG=$1
15+
for IMAGES in peer orderer couchdb ccenv javaenv kafka zookeeper tools; do
16+
echo "==> FABRIC IMAGE: $IMAGES"
17+
echo
18+
docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG
19+
docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES
20+
done
21+
}
22+
23+
dockerCaPull() {
24+
local CA_TAG=$1
25+
echo "==> FABRIC CA IMAGE"
26+
echo
27+
docker pull hyperledger/fabric-ca:$CA_TAG
28+
docker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca
29+
}
30+
31+
: ${CA_TAG:="$MARCH-$VERSION"}
32+
: ${FABRIC_TAG:="$MARCH-$VERSION"}
33+
34+
echo "===> Pulling fabric Images"
35+
dockerFabricPull ${FABRIC_TAG}
36+
37+
echo "===> Pulling fabric ca Image"
38+
dockerCaPull ${CA_TAG}
39+
echo
40+
echo "===> List out hyperledger docker images"
41+
docker images | grep hyperledger*
42+

0 commit comments

Comments
 (0)