[CORD-1541] Building the xos-tosca container

Change-Id: Ie1a27bb4606a511f5095a945e0be26623b563b96
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..5465185
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,6 @@
+.idea
+cover
+docs
+test
+Dockerfile
+Makefile
diff --git a/.gitignore b/.gitignore
index 59910ec..900c131 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,7 @@
 # Test Coverage
 .coverage
 cover
-coverage.xml
\ No newline at end of file
+coverage.xml
+
+# hack
+xos
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index fe7ab6d..ebd0af3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,2 +1,35 @@
 # xosproject/xos-tosca
-FROM xosproject/xos-client:candidate
\ No newline at end of file
+FROM xosproject/xos-client:candidate
+
+# Set environment variables
+ENV CODE_SOURCE .
+ENV CODE_DEST /opt/xos-tosca
+WORKDIR ${CODE_DEST}
+
+# Add XOS-TOSCA code
+COPY ${CODE_SOURCE}/ ${CODE_DEST}/
+
+# Install dependencies
+RUN pip install -r ${CODE_DEST}/pip_requirements.txt
+
+EXPOSE 9102
+
+
+# Label image
+ARG org_label_schema_schema_version=1.0
+ARG org_label_schema_name=xos-tosca
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+
+LABEL org.label-schema.schema-version=$org_label_schema_schema_version \
+      org.label-schema.name=$org_label_schema_name \
+      org.label-schema.version=$org_label_schema_version \
+      org.label-schema.vcs-url=$org_label_schema_vcs_url \
+      org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
+      org.label-schema.build-date=$org_label_schema_build_date \
+      org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date
+
+ENTRYPOINT [ "/usr/bin/python", "src/main.py" ]
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 8c4526b..36fc749 100644
--- a/Makefile
+++ b/Makefile
@@ -2,15 +2,22 @@
 	@echo "tests: Run unit tests (if you're running local, you'll need to have virtual-env activated)"
 	@echo "tosca: Generate tosca definition from core.xproto"
 	@echo "test-call: Send a sample tosca recipe"
+	@echo "build: Build the docker image for xos-tosca"
+	@echo "start: Run an xos-tosca container"
+	@echo "clean: Remove the xos-tosca container (if any), and the image (if any)"
 
 tests: tosca
 	nosetests -s -v --with-id --with-coverage --cover-html --cover-erase --cover-xml --cover-package="grpc_client, tosca"
 
 build:
-	@echo 'TBD'
+	docker build -t xosproject/xos-tosca --no-cache=true .
+
+start: build
+	docker run -p 9200:9200 --name xos-tosca -d xosproject/xos-tosca
 
 clean:
-	@echo 'TBD'
+	docker rm -f xos-tosca || true
+	docker rmi -f xosproject/xos-tosca || true
 
 test-call:
 	curl -H "xos-username: xosadmin@opencord.org" -H "xos-password: rk1UYDHZXbu6KVCMkhmV" -X POST --data-binary @test/tosca/test.yaml 127.0.0.1:9200/run
diff --git a/src/web_server/main.py b/src/web_server/main.py
index aaf2c66..611d40e 100644
--- a/src/web_server/main.py
+++ b/src/web_server/main.py
@@ -40,4 +40,4 @@
         return d
 
     def __init__(self):
-        self.app.run('localhost', '9200')
\ No newline at end of file
+        self.app.run('0.0.0.0', '9102')
\ No newline at end of file
diff --git a/src/xos-tosca-config.yaml b/src/xos-tosca-config.yaml
index 6ed2b43..20ca069 100644
--- a/src/xos-tosca-config.yaml
+++ b/src/xos-tosca-config.yaml
@@ -1,3 +1,5 @@
+# NOTE in a deployment I'm overridden by platform install
+
 name: xos-tosca
 grpc:
   secure_endpoint: "xos-core.opencord.org:50051"