forked from ChorusOne/solido
-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildimage.sh
executable file
·51 lines (41 loc) · 1.34 KB
/
buildimage.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
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021 Chorus One AG
# SPDX-License-Identifier: GPL-3.0
# 1. Get last commit hash
VERSION=$(git rev-parse --short HEAD)
TAG="guyos/solido:$VERSION"
BASETAG="guyos/solido-base"
SOLIPATH="/root/.local/share/solana/install/releases/1.9.28/solana-release/bin/solido"
# 2. Build container image
echo "Building container image $TAG"
docker build -t $BASETAG -f docker/Dockerfile.base .
docker build -t $TAG -f docker/Dockerfile.dev .
# 3. Clean directory for artefacts
echo "Cleaning artefact directories"
rm -rf build
mkdir -p build
#4. Run container
echo "Running build container $TAG"
$(docker run --rm -it $TAG sleep 15) &
sleep 2
#5. Find container id
CON_ID=$(docker ps | grep $TAG | awk '{print $1}')
echo "Running container id is=$CON_ID"
#6. Copy artefacts locally
## a. on-chain
programs=("lido" "serum_multisig")
for i in "${programs[@]}"
do
echo "Copying $i program and hash"
docker cp $CON_ID:$SOLIPATH/deploy/$i.so ./build/$i.so
docker cp $CON_ID:$SOLIPATH/deploy/$i.hash ./build/$i.hash
done
## b. cli
programs=("solido" "listener")
for i in "${programs[@]}"
do
echo "Copying $i cli and hash to build"
docker cp $CON_ID:$SOLIPATH/cli/$i ./build/$i
docker cp $CON_ID:$SOLIPATH/cli/$i.hash ./build/$i.hash
done
echo "All build artefacts copied to ./build. Associated container will exit shortly."