-
Notifications
You must be signed in to change notification settings - Fork 496
/
docker-images.sh
69 lines (62 loc) · 1.83 KB
/
docker-images.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -eu
dockerFabricPull() {
local FABRIC_TAG=$1
for IMAGES in peer orderer ccenv; 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
}
BUILD=
DOWNLOAD=
if [ $# -eq 0 ]; then
BUILD=true
PUSH=true
DOWNLOAD=true
else
for arg in "$@"
do
if [ $arg == "build" ]; then
BUILD=true
fi
if [ $arg == "download" ]; then
DOWNLOAD=true
fi
done
fi
if [ $DOWNLOAD ]; then
: ${CA_TAG:="latest"}
: ${FABRIC_TAG:="latest"}
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*
fi
if [ $BUILD ];
then
echo '############################################################'
echo '# BUILDING CONTAINER IMAGES #'
echo '############################################################'
docker build -t orderer:latest orderer/
docker build -t insurance-peer:latest insurancePeer/
docker build -t police-peer:latest policePeer/
docker build -t shop-peer:latest shopPeer/
docker build -t repairshop-peer:latest repairShopPeer/
docker build -t web:latest web/
docker build -t insurance-ca:latest insuranceCA/
docker build -t police-ca:latest policeCA/
docker build -t shop-ca:latest shopCA/
docker build -t repairshop-ca:latest repairShopCA/
fi