-
Notifications
You must be signed in to change notification settings - Fork 4
/
test-template.sh
executable file
·59 lines (46 loc) · 1.32 KB
/
test-template.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
#!/bin/bash
# docker run -d -p 6379:6379 redis
# docker run -d -p 9200:9200 elasticsearch:2.3.5
context=.
container="castle-latest"
version="latest"
image="realworldio/castlecms:$version"
cmd="docker build -t $image $context"
function base_installer {
cmd="docker build -t $image $context"
echo ">>>> Build image: $image"
echo "---> $cmd"
$cmd
cmd="docker run -d -p 8080:8080 -e SITE='Castle' --name $container $image"
echo ">>>> Run container: $container"
echo "---> $cmd"
$cmd
sleep 30s
docker logs $container
cmd="docker exec $container ./bin/test -s castle.cms -t \!robot"
echo ">>>> Test container: $container"
echo "---> $cmd"
$cmd
cmd="docker stop $container"
echo ">>>> Stop container: $container"
echo "---> $cmd"
$cmd
cmd="docker rm $container"
echo ">>>> Remove container: $container"
echo "---> $cmd"
$cmd
}
base_installer
for file in $(find ./*/ -type f -name 'Dockerfile'); do
context="$(dirname $file)"
based_os="$(dirname $context)"
version="$(basename $based_os)"
image="realworldio/castlecms:$version"
container="castle-$version"
echo "Building image for Castle:$version"
base_installer
# cmd="docker rmi $image"
# echo ">>>> Remove container: $image"
# echo "---> $cmd"
# $cmd
done