Added a build for the portainer docker container. Portainer is a web ui
that simplifies monitoring and operations on Docker containers. The
build process moves the root of the UI to make it easier to integrate
later into a web UI consolidation to a single port through a prox
server. Portainer can currently be accessed at port 9000 of the docker
host.

Change-Id: I44d38846ac820e17e1854389613b75253782d8f2
diff --git a/Makefile b/Makefile
index 28502c1..a893794 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 VENVDIR := venv-$(shell uname -s | tr '[:upper:]' '[:lower:]')
 
-.PHONY: $(DIRS) $(DIRS_CLEAN) $(DIRS_FLAKE8) flake8 docker-base voltha chameleon ofagent podder netconf shovel onos
+.PHONY: $(DIRS) $(DIRS_CLEAN) $(DIRS_FLAKE8) flake8 docker-base voltha chameleon ofagent podder netconf shovel onos dashd vcli portainer
 
 default: build
 
@@ -76,7 +76,7 @@
 
 build: protos containers
 
-containers: docker-base voltha chameleon ofagent podder netconf shovel onos tester config-push
+containers: docker-base voltha chameleon ofagent podder netconf shovel onos tester config-push dashd vcli portainer
 
 docker-base:
 	docker build -t cord/voltha-base -f docker/Dockerfile.base .
@@ -108,6 +108,9 @@
 vcli:
 	docker build -t cord/vcli -f docker/Dockerfile.cli .
 
+portainer:
+	portainer/buildPortainer.sh
+
 onos:
 	docker build -t cord/onos -f docker/Dockerfile.onos docker
 
@@ -139,6 +142,7 @@
 	docker pull ubuntu:xenial
 	docker pull wurstmeister/kafka:latest
 	docker pull wurstmeister/zookeeper:latest
+	docker pull portainer/portainer:latest
 
 purge-venv:
 	rm -fr ${VENVDIR}
diff --git a/compose/docker-compose-system-test.yml b/compose/docker-compose-system-test.yml
index 88d2591..2d9f338 100644
--- a/compose/docker-compose-system-test.yml
+++ b/compose/docker-compose-system-test.yml
@@ -242,6 +242,21 @@
     volumes:
     - "/var/run/docker.sock:/tmp/docker.sock"
 
+  #
+  # Docker ui
+  #
+  portainer:
+    image: voltha/portainer
+    ports:
+    - "9000:9000"
+    environment:
+      CONSUL_ADDR: "${DOCKER_HOST_IP}:8500"
+    depends_on:
+    - nginx
+    restart: unless-stopped
+    volumes:
+    - "/var/run/docker.sock:/var/run/docker.sock"
+
 networks:
   default:
     driver: bridge
diff --git a/docker/Dockerfile.portainer b/docker/Dockerfile.portainer
new file mode 100644
index 0000000..e3a894f
--- /dev/null
+++ b/docker/Dockerfile.portainer
@@ -0,0 +1,11 @@
+FROM centurylink/ca-certs
+
+COPY tmp_portainer /
+
+VOLUME /data
+
+WORKDIR /
+
+EXPOSE 9000
+
+ENTRYPOINT ["/portainer"]
diff --git a/portainer/buildPortainer.sh b/portainer/buildPortainer.sh
new file mode 100755
index 0000000..36a2707
--- /dev/null
+++ b/portainer/buildPortainer.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+docker run --rm -d --name pbuild -p 9999:9000 portainer/portainer
+rm -fr tmp_portainer
+mkdir tmp_portainer
+docker cp pbuild:/ tmp_portainer
+
+sed -i -e '
+s~constant("DOCKER_ENDPOINT","api/docker")~constant("DOCKER_ENDPOINT","docker/api/docker")~
+s~constant("CONFIG_ENDPOINT","api/settings")~constant("CONFIG_ENDPOINT","docker/api/settings")~
+s~constant("AUTH_ENDPOINT","api/auth")~constant("AUTH_ENDPOINT","docker/api/auth")~
+s~constant("USERS_ENDPOINT","api/users")~constant("USERS_ENDPOINT","docker/api/users")~
+s~constant("ENDPOINTS_ENDPOINT","api/endpoints")~constant("ENDPOINTS_ENDPOINT","docker/api/endpoints")~
+s~constant("TEMPLATES_ENDPOINT","api/templates")~constant("TEMPLATES_ENDPOINT","docker/api/templates")~
+' tmp_portainer/js/app.*.js
+
+
+docker build -t voltha/portainer -f docker/Dockerfile.portainer .
+rm -fr tmp_portainer
+docker stop pbuild
+