Add dockerfile for MDG's

- Added option to installer to use specfic docker build tag

Change-Id: Ia6cf6316c6fb84a18ecdbaf98747a95c20ce2f0b
Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
diff --git a/installers/docker/docker-compose.yaml b/installers/docker/docker-compose.yaml
index 6924314..fefd66e 100644
--- a/installers/docker/docker-compose.yaml
+++ b/installers/docker/docker-compose.yaml
@@ -13,13 +13,13 @@
     #  com.docker.network.driver.mtu: "1446"
 services:
   zookeeper:
-    image: wurstmeister/zookeeper
+    image: wurstmeister/zookeeper:${ZOOKEEPER_TAG:-latest}
 #    ports:
 #      - "2181:2181"
     networks:
       - netOSM
   kafka:
-    image: wurstmeister/kafka
+    image: wurstmeister/kafka:${KAFKA_TAG:-latest}
     ports:
       - "9092"
     networks:
@@ -41,7 +41,7 @@
     volumes:
       - mongo_db:/data/db
   nbi:
-    image: osm/nbi
+    image: osm/nbi:${TAG:-latest}
     networks:
       - netOSM
     volumes:
@@ -55,7 +55,7 @@
     #  - kafka
     #  - mongo
   lcm:
-    image: osm/lcm
+    image: osm/lcm:${TAG:-latest}
     networks:
       - netOSM
     volumes:
@@ -81,7 +81,7 @@
 #    ports:
 #      - "3306:3306"
   ro:
-    image: osm/ro
+    image: osm/ro:${TAG:-latest}
     networks:
       - netOSM
     environment:
@@ -93,7 +93,7 @@
     ports:
       - "${OSM_RO_PORTS:-9090:9090}"
   mon:
-    image: osm/mon
+    image: osm/mon:${TAG:-latest}
     networks:
       - netOSM
     volumes:
@@ -108,7 +108,7 @@
     ports:
       - "8662"
   pm:
-    image: osm/pm
+    image: osm/pm:${TAG:-latest}
     networks:
       - netOSM
     environment:
@@ -117,7 +117,7 @@
     #  - kafka
     #  - mon
   light-ui:
-    image: osm/light-ui
+    image: osm/light-ui:${TAG:-latest}
     networks:
       - netOSM
     environment:
diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh
index fa1c9ef..f96bfae 100755
--- a/installers/full_install_osm.sh
+++ b/installers/full_install_osm.sh
@@ -36,6 +36,7 @@
     echo -e "     -o <ADDON>:     ONLY (un)installs one of the addons (vimemu, elk_stack, pm_stack)"
     echo -e "     -D <devops path> use local devops installation path"
     echo -e "     -w <work dir>   Location to store runtime installation"
+    echo -e "     -t <docker tag> specify osm docker tag (default is latest)"
     echo -e "     --nolxd:        do not install and configure LXD, allowing unattended installations (assumes LXD is already installed and confifured)"
     echo -e "     --nodocker:     do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)"
     echo -e "     --nojuju:       do not juju, assumes already installed"
@@ -629,7 +630,7 @@
         # Not found created, create the controller
         sg lxd -c "juju bootstrap --bootstrap-series=xenial localhost $OSM_STACK_NAME"
     fi
-    [ $(sg lxd -c "juju controllers" |grep "$OSM_STACK_NAME" |wc -l) -eq 1 ] || FATAL "Juju installation failed"
+    [ $(sg lxd -c "juju controllers" | awk "/^${OSM_STACK_NAME}[\*| ]/{print $1}"|wc -l) -eq 1 ] || FATAL "Juju installation failed"
 }
 
 function generate_docker_images() {
@@ -720,7 +721,7 @@
 }
 
 function generate_osmclient_script () {
-    echo "docker run -ti --network net${OSM_STACK_NAME} osm/osmclient" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm
+    echo "docker run -ti --network net${OSM_STACK_NAME} osm/osmclient:${OSM_DOCKER_TAG}" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm
     $WORKDIR_SUDO chmod +x "$OSM_DOCKER_WORK_DIR/osm"
     echo "osmclient sidecar container can be found at: $OSM_DOCKER_WORK_DIR/osm"
 }
@@ -759,6 +760,7 @@
     fi
     echo "export ${OSM_PORTS[@]}" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm_ports.sh
     echo "export OSM_NETWORK=net${OSM_STACK_NAME}" | $WORKDIR_SUDO tee --append $OSM_DOCKER_WORK_DIR/osm_ports.sh
+    echo "export TAG=${OSM_DOCKER_TAG}" | $WORKDIR_SUDO tee --append $OSM_DOCKER_WORK_DIR/osm_ports.sh
 
     pushd $OSM_DOCKER_WORK_DIR
     sg docker -c "source ./osm_ports.sh; docker stack deploy -c $OSM_DOCKER_WORK_DIR/docker-compose.yaml $OSM_STACK_NAME"
@@ -1013,8 +1015,9 @@
 REPOSITORY_BASE="http://osm-download.etsi.org/repository/osm/debian"
 WORKDIR_SUDO=sudo
 OSM_WORK_DIR="/etc/osm"
+OSM_DOCKER_TAG=latest
 
-while getopts ":hy-:b:r:k:u:R:l:p:D:o:m:H:S:s:w:" o; do
+while getopts ":hy-:b:r:k:u:R:l:p:D:o:m:H:S:s:w:t:" o; do
     case "${o}" in
         h)
             usage && exit 0
@@ -1061,6 +1064,9 @@
             WORKDIR_SUDO=
             OSM_WORK_DIR="${OPTARG}"
             ;;
+        t)
+            OSM_DOCKER_TAG="${OPTARG}"
+            ;;
         o)
             INSTALL_ONLY="y"
             [ "${OPTARG}" == "vimemu" ] && INSTALL_VIMEMU="y" && continue