-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparseimages
42 lines (36 loc) · 1.25 KB
/
parseimages
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
#!/bin/bash
#
# Parses the docker image file
# Develop by Ravikumar Paghdal
# 04th Jan 2021
source utils
declare -a descs cmd_fresh cmd_start cmd_stop cmd_remove
declare -A REPONAME TAG NAME ADD_OPTIONS PORT_ARGS POST_DOC_CMD POST_CMD
DOCLIST="/bin/doclist.csv"
log "[+] Parsing ${DOCLIST} file"
count=0
while IFS=',' read REPO TAG NAME APP_NAME ADD_OPTIONS PORT_ARGS POST_DOC_CMD POST_CMD REF
do
if [ "$REPO" != "" ]
then
REPONAME[$count]="$REPO:$TAG"
NAME[$count]=$NAME
PORT_ARGS[$count]=$PORT_ARGS
APP_NAME[$count]=$APP_NAME
descs[$count]=$APP_NAME
PORT_ARGS[$count]=$PORT_ARGS
cmd_fresh[$count]="docker run $ADD_OPTIONS --rm --name $NAME $PORT_ARGS $REPO:$TAG $POST_DOC_CMD"
if [[ -n ${POST_CMD} ]]
then
cmd_start[$count]="docker run $ADD_OPTIONS --rm --name $NAME $PORT_ARGS $REPO:$TAG $POST_DOC_CMD"
cmd_post[$count]="$POST_CMD"
else
cmd_start[$count]="docker run $ADD_OPTIONS --rm --name $NAME $PORT_ARGS $REPO:$TAG $POST_DOC_CMD"
cmd_post[$count]=""
fi
cmd_stop[$count]="docker stop $NAME"
cmd_remove[$count]="docker rm $NAME"
fi
count=$((count + 1))
done <<< "$(cat "${DOCLIST}" | sed -e 's/#.*//g')"
log "[+] Parsing ${DOCLIST} file completed"