File tree 3 files changed +15
-11
lines changed
3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,12 @@ before_install:
9
9
10
10
before_script :
11
11
- docker version
12
+ - docker login --email=$DOCKER_EMAIL --username=$DOCKER_USERNAME --password=$DOCKER_PASSWORD
12
13
# Ancient make binary at TravisCI doesn't support indentation with spaces
13
14
- unexpand -t 4 Makefile > Makefile.tmp && mv Makefile.tmp Makefile
14
15
15
16
script :
16
17
- make test
18
+
19
+ after_success :
20
+ - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then docker push domcode/raffler; fi
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- echo " Using docker(` docker version -f " {{.Server.Version}} / {{.Client.Version}}" ` ) to build containers ..."
3
+ echo " Using docker(` docker version -f " {{.Server.Version}} / {{.Client.Version}}" ` ) to build container images ..."
4
4
5
5
if [[ " $1 " && " $1 " != " --rebuild" ]]; then
6
6
dockerfiles=(" $1 /Dockerfile" )
10
10
11
11
for file in $dockerfiles ; do
12
12
dir=${file: 0:- 11}
13
- container= ${dir/ -/ _} " _raffler "
14
- if [[ $1 == " --rebuild" || $( docker images | awk ' {print $1}' | grep -c ' ^' " $container " ' $' ) -eq 0 ]]; then
15
- echo " Building $container from $dir "
16
- docker build -q -t " $container " " $dir "
13
+ tag= " domcode/raffler: ${dir/ -/ _} "
14
+ if [[ $1 == " --rebuild" || $( docker images | awk ' {print $1}' | grep -c ' ^' " $tag " ' $' ) -eq 0 ]]; then
15
+ echo " Building $tag from $dir "
16
+ docker build -q -t " $tag " " $dir "
17
17
if [[ $? != 0 ]]; then
18
18
echo " Build failed!"
19
19
exit 1
20
20
fi
21
21
else
22
- echo " Skipping $container - already exists"
22
+ echo " Skipping $tag - already exists"
23
23
fi
24
24
done
Original file line number Diff line number Diff line change @@ -16,12 +16,12 @@ NAMES_FILE=$(realpath "$WORKING_DIR/$1")
16
16
cp " $NAMES_FILE " " $NAMES_DIR /current"
17
17
18
18
# Raffle a raffler ;-)
19
- declare RAFFLER_NAMES=($( docker images | awk ' {print $1}' | grep ' _raffler$' ) )
20
- RANDOM_RAFFLER=${RAFFLER_NAMES[$RANDOM % ${#RAFFLER_NAMES[@]} ]}
19
+ declare RAFFLER_TAGS=($( docker images | awk ' {print $1":"$2}' | grep domcode/raffler) )
20
+
21
+ RANDOM_RAFFLER_TAG=${RAFFLER_TAGS[$RANDOM % ${#RAFFLER_TAGS[@]} ]}
21
22
22
23
# run raffler in container with names dir mounted
23
- CONTAINER_NAME=" ${RANDOM_RAFFLER} "
24
- echo -e " Raffling using \033[91m$RANDOM_RAFFLER \e[0m"
24
+ echo -e " Raffling using \033[91m$RANDOM_RAFFLER_TAG \e[0m"
25
25
echo -e " \033[92mAnd the winner is: "
26
- docker run -v $NAMES_DIR :/var/names " $CONTAINER_NAME "
26
+ docker run -v $NAMES_DIR :/var/names " $RANDOM_RAFFLER_TAG "
27
27
echo -e " \e[0m"
You can’t perform that action at this time.
0 commit comments