-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildscript
executable file
·35 lines (33 loc) · 896 Bytes
/
buildscript
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
DOCKER_IMAGE=yuluyi/ckb-dev-all-in-one:0.1.0-amd64
DOCKER_CONTAINER="das-lock-dev"${PWD//\//_}
CACHE_VOLUME="das-lock-cache"
case $1 in
start)
dir=$PWD
if [[ $2 == "-b" || $2 == "--background" ]]; then
docker run -d -t --rm \
--name $DOCKER_CONTAINER \
--network host \
-v .:/code \
-v $CACHE_VOLUME:/root/.cargo \
-v ~/.gitconfig:/root/.gitconfig:ro \
$DOCKER_IMAGE /bin/bash &>/dev/null
else
docker run -it --rm \
--name $DOCKER_CONTAINER \
--network host \
-v .:/code \
-v ~/.gitconfig:/root/.gitconfig:ro \
-v $CACHE_VOLUME:/root/.cargo \
$DOCKER_IMAGE \
/bin/bash
fi
;;
build)
if [[ $2 == '--release' ]]; then
docker exec -it -w /code $DOCKER_CONTAINER bash -c "cargo build --release"
else
docker exec -it -w /code $DOCKER_CONTAINER bash -c "cargo build"
fi
;;
esac