-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·74 lines (62 loc) · 1.59 KB
/
make.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
70
71
72
73
#!/bin/sh
set -ue
rundir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
canonical="$rundir/$(basename -- "$0")"
if [ -n "${1:-}" ]; then
cmd=$1
shift
else
cmd=build
fi
cd "$rundir"
###
SCOPE="dply"
NAME="node-domain-tree-test"
IMAGE="$SCOPE/$NAME"
build_test_docker(){
set -x
#build_test_docker_version 4
build_test_docker_version 6 "-q"
build_test_docker_version 8 "-q" # lts
build_test_docker_version 9 "-q" # latest
docker tag $IMAGE:9 $IMAGE:latest
docker tag $IMAGE:8 $IMAGE:lts
}
build_test_docker_version(){
build_test_docker_version=${1:-latest}
build_test_docker_version_args=${2:-}
docker build \
$build_test_docker_version_args \
--build-arg NODE_VERSION=$build_test_docker_version \
-t $IMAGE:$build_test_docker_version \
-f test/fixture/Dockerfile \
.
}
run_test(){
docker run $IMAGE:lts
}
run_test_all(){
build_test_docker
#docker run $IMAGE:4
docker run --rm $IMAGE:6
docker run --rm $IMAGE:8
docker run --rm $IMAGE:9
}
###
run_help(){
echo "Commands:"
awk '/ ".*"/{ print " "substr($1,2,length($1)-3) }' make.sh
}
set +x
case $cmd in
"build") build_test_docker "$@";;
"build:test") build_test_docker "$@";;
"build:test:docker") build_test_docker "$@";;
"test") run_test "$@";;
"test:all") run_test_all "$@";;
"test:lts") run_test_lts "$@";;
"test:latest") run_test_latest "$@";;
"watch") run_watch "$@";;
'-h'|'--help'|'h'|'help') run_help;;
*) $cmd "$@";;
esac