forked from yeasy/docker-hyperledger
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-setup.sh
60 lines (53 loc) · 2.35 KB
/
docker-setup.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
#!/bin/bash
set -e
export FABRIC_REPO=joequant
export PATH=/opt/gopath/bin:/opt/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#install go and protobuf
rm -f /var/lib/apt/lists/*Sources* /var/lib/apt/lists/*universe*
sed -i /universe/d /etc/apt/sources.list
apt-get purge -y eject whiptail
apt-get install -y curl binutils golang-1.6-go apt-utils
rm -rf /var/cache/apt /usr/share/doc /usr/share/man
rm -rf /usr/share/go-1.6/test
ln -s $GOROOT /opt/go
ln -s $GOROOT /opt/gopath
mkdir -p /var/hyperledger/db
mkdir -p /var/hyperledger/production
strip --strip-unneeded /usr/bin/* /usr/sbin/* || true
strip --strip-unneeded $GOROOT/bin/* $GOROOT/pkg/tool/*/* || true
apt-get install -y protobuf-compiler libsnappy-dev zlib1g-dev libbz2-dev \
unzip build-essential git-core libstdc++-5-dev \
--no-install-recommends --no-install-suggests
strip --strip-unneeded /usr/bin/* /usr/sbin/* || true
strip --strip-unneeded /usr/lib/* /usr/local/lib/* || true
rm -rf /var/cache/apt /usr/share/doc /usr/share/man
#install rocksdb
cd /tmp
git clone --single-branch -b v4.6.1 --depth 1 https://github.com/facebook/rocksdb.git
cd rocksdb
PORTABLE=1 make shared_lib
INSTALL_PATH=/usr/local make install-shared
ldconfig
cd ..
rm -rf rocksdb
apt-get purge -y make patch xz-utils g++ libdpkg-perl \
libtimedate-perl sgml-base xml-core xdg-user-dirs manpages \
krb5-locales libglib2.0-0 libxtables11 shared-mime-info \
ifupdown rename
apt-get purge -y --allow-remove-essential sed e2fsprogs
apt-get autoremove -y
strip --strip-unneeded /usr/local/lib/* || true
# install hyperledger
mkdir -p $GOPATH/src/github.com/hyperledger
cd $GOPATH/src/github.com/hyperledger
git clone --single-branch --depth 1 https://github.com/$FABRIC_REPO/fabric.git
cd $GOPATH/src/github.com/hyperledger/fabric/peer
CGO_CFLAGS=" " CGO_LDFLAGS="-lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy" go install
curl https://raw.githubusercontent.com/joequant/hyperledger/master/config/core.yaml > $GOPATH/bin/core.yaml
go clean
cd $GOPATH/src/github.com/hyperledger/fabric/membersrvc
CGO_CFLAGS=" " CGO_LDFLAGS="-lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy" go install
curl https://raw.githubusercontent.com/joequant/hyperledger/master/config/membersrvc.yaml > $GOPATH/bin/membersrvc.yaml
go clean
strip $GOPATH/bin/* || true
cp $GOPATH/src/github.com/hyperledger/fabric/consensus/noops/config.yaml $GOPATH/bin