File tree 1 file changed +7
-15
lines changed
1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -14,18 +14,18 @@ function getTags() {
14
14
15
15
function restartContainer() {
16
16
REPOSITORY=$1
17
- PORTS= $2
17
+ COMMAND= " $2 "
18
18
echo " New version of ${REPOSITORY} available. Deploying..."
19
19
docker stop $( docker ps -q --filter ancestor=${REPOSITORY} )
20
20
docker rm $( docker ps -q -f status=exited)
21
21
docker rmi $( docker images -q -f dangling=true)
22
22
docker pull ${REPOSITORY}
23
- docker run --restart=always -d -p ${PORTS } ${REPOSITORY}
23
+ eval " ${COMMAND } ${REPOSITORY} "
24
24
}
25
25
26
26
function checkForNewVersion() {
27
27
REPOSITORY=$1
28
- PORTS= $2
28
+ COMMAND= " $2 "
29
29
CURRENT_TAGS_FILE=` tagsFile ${REPOSITORY} " current" `
30
30
NEW_TAGS_FILE=` tagsFile ${REPOSITORY} " new" `
31
31
if [ -f ${CURRENT_TAGS_FILE} ];
@@ -36,27 +36,19 @@ function checkForNewVersion() {
36
36
if [ " ${FILES_DIFF} " != " " ];
37
37
then
38
38
getTags ${REPOSITORY} ${CURRENT_TAGS_FILE}
39
- restartContainer ${REPOSITORY} ${PORTS}
39
+ restartContainer " ${REPOSITORY} " " ${COMMAND} "
40
40
fi
41
41
else
42
42
getTags ${REPOSITORY} ${CURRENT_TAGS_FILE}
43
- restartContainer ${REPOSITORY} ${PORTS}
43
+ restartContainer " ${REPOSITORY} " " ${COMMAND} "
44
44
fi
45
45
}
46
46
47
47
48
48
DOCKER_HUB_REPOSITORY=$1
49
- EXPOSED_PORTS=$2
50
-
51
- checkForNewVersion ${DOCKER_HUB_REPOSITORY} ${EXPOSED_PORTS}
52
-
53
-
54
-
55
-
56
-
57
-
58
-
49
+ COMMAND=" $2 "
59
50
51
+ checkForNewVersion ${DOCKER_HUB_REPOSITORY} " ${COMMAND} "
60
52
61
53
62
54
You can’t perform that action at this time.
0 commit comments