-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·52 lines (41 loc) · 1.06 KB
/
build.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
#!/bin/bash
NETWORK=
usage() {
me=$(basename "$0")
cat <<-EOT
Usage: this script is used to build docker image for current branch and tag.
$me [options]
Options:
-h print this message
-n network network of the docker image (e.g. testnet/mainnet)
EOT
exit 0
}
while getopts ':hn:' opt; do
case $opt in
n) NETWORK="$OPTARG";;
*) usage ;;
esac
done
if [ -z "$NETWORK" ]; then
usage
fi
if [ "$NETWORK" == "mainnet" ]; then
sudo docker build -f Dockerfile.build -t ethhmy-bridge.fe .
else
sudo docker build -f Dockerfile.build."$NETWORK" -t ethhmy-bridge.fe .
fi
rm -rf artifacts
mkdir artifacts
sudo docker run -i --rm -v ${PWD}/artifacts:/mnt/artifacts ethhmy-bridge.fe /bin/bash << COMMANDS
cp /app/ethhmy-bridge-fe.tgz /mnt/artifacts
chown -R $(id -u):$(id -g) /mnt/artifacts
COMMANDS
pushd artifacts
tar xfz ethhmy-bridge-fe.tgz
popd
if [ "$NETWORK" == "mainnet" ]; then
sudo docker build -f Dockerfile.fe-static -t ethhmy-fe-web .
else
sudo docker build -f Dockerfile.fe-static -t ethhmy-fe-web:"$NETWORK" .
fi