[CORD-1541] Building TOSCA container

Change-Id: Ibc3d5522c5f9233635bbc8bd56c930f409290725
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index f3db714..a31c312 100644
--- a/containers/xos/Dockerfile.client
+++ b/containers/xos/Dockerfile.client
@@ -1,5 +1,5 @@
 # xosproject/xos-client
-FROM xosproject/xos-base:candidate
+FROM xosproject/xos-libraries:candidate
 
 # Install XOS client
 ADD xos/xos_client /tmp/xos_client
diff --git a/containers/xos/Dockerfile.corebuilder b/containers/xos/Dockerfile.corebuilder
index 1d1ef7d0..8db5d34 100644
--- a/containers/xos/Dockerfile.corebuilder
+++ b/containers/xos/Dockerfile.corebuilder
@@ -1,5 +1,5 @@
 # xosproject/xos-corebuilder
-FROM xosproject/xos-base:candidate
+FROM xosproject/xos-libraries:candidate
 
 # Label image
 ARG org_label_schema_schema_version=1.0
@@ -24,17 +24,6 @@
 ENV HOME /root
 WORKDIR /opt/xos/tools/corebuilder
 
-# Add libraries
-ADD lib /opt/xos/lib
-
-# Install the config module
-RUN cd /opt/xos/lib/xos-config/; \
-	python setup.py install
-
-# Install the xosgenx library
-RUN cd /opt/xos/lib/xos-genx/; \
-	python setup.py install
-
 # Install the corebuilder tools and the tosca custom_types that it needs
 ADD xos/tools/corebuilder /opt/xos/tools/corebuilder
 ADD xos/tosca/custom_types /opt/xos/tools/corebuilder/custom_types
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
new file mode 100644
index 0000000..e56361f
--- /dev/null
+++ b/containers/xos/Dockerfile.libraries
@@ -0,0 +1,28 @@
+FROM xosproject/xos-base:candidate
+
+# Add libraries
+COPY lib /opt/xos/lib
+
+# Install the config module
+# and the xosgenx library
+RUN cd /opt/xos/lib/xos-config/; \
+	python setup.py install; \
+	cd /opt/xos/lib/xos-genx/; \
+	python setup.py install
+
+# Label image
+ARG org_label_schema_schema_version=1.0
+ARG org_label_schema_name=xos-libraries
+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
\ No newline at end of file
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index 325f831..e761e5b 100644
--- a/containers/xos/Dockerfile.synchronizer-base
+++ b/containers/xos/Dockerfile.synchronizer-base
@@ -6,11 +6,6 @@
 COPY xos/xos/xml_util.py /opt/xos/xos/xml_util.py
 COPY xos/xos/__init__.py /opt/xos/xos/__init__.py
 COPY xos/synchronizers/__init__.py /opt/xos/synchronizers/__init__.py
-COPY lib/xos-config /opt/xos/lib/xos-config
-
-# Install the config module
-RUN cd /opt/xos/lib/xos-config/; \
-	python setup.py install
 
 # Label image
 ARG org_label_schema_schema_version=1.0
diff --git a/containers/xos/Dockerfile.xos b/containers/xos/Dockerfile.xos
index e84c678..5b1d176 100644
--- a/containers/xos/Dockerfile.xos
+++ b/containers/xos/Dockerfile.xos
@@ -1,5 +1,5 @@
 # xosproject/xos
-FROM xosproject/xos-base:candidate
+FROM xosproject/xos-libraries:candidate
 
 # Install XOS
 ADD xos /opt/xos
@@ -16,14 +16,6 @@
 # Define working directory
 WORKDIR /opt/xos
 
-# Install the config module
-RUN cd /opt/xos/lib/xos-config/; \
-	python setup.py install
-
-# Install the xosgenx library
-RUN cd /opt/xos/lib/xos-genx/; \
-	python setup.py install
-
 # Label image
 ARG org_label_schema_schema_version=1.0
 ARG org_label_schema_name=xos
diff --git a/group_vars/all b/group_vars/all
index 8cdff65..f2e1b3b 100644
--- a/group_vars/all
+++ b/group_vars/all
@@ -23,6 +23,11 @@
     dockerfile: "Dockerfile"
     pull: True
     publish: True
+  - name: "xosproject/xos-libraries"
+    path: "{{ build_cord_dir }}/orchestration/xos"
+    dockerfile: "containers/xos/Dockerfile.libraries"
+    pull: False
+    publish: True
   - name: "xosproject/xos"
     path: "{{ build_cord_dir }}/orchestration/xos"
     dockerfile: "containers/xos/Dockerfile.xos"
@@ -78,6 +83,11 @@
     dockerfile: ""
     pull: True
     publish: False
+  - name: "xosproject/xos-tosca"
+    path: "{{ build_cord_dir }}/orchestration/xos-tosca"
+    dockerfile: "Dockerfile"
+    pull: False
+    publish: True
 
 build_optional_images: False