Imgabuilder - Ignoring files listed in .dockerignore

Change-Id: If6a7f78541224311be55166c326c3e55c3641627
(cherry picked from commit 7fadd59954a9322c1084f252a495f5e0fbac9d51)
diff --git a/scripts/imagebuilder.py b/scripts/imagebuilder.py
index 3bc4947..283ae80 100755
--- a/scripts/imagebuilder.py
+++ b/scripts/imagebuilder.py
@@ -666,6 +666,13 @@
             # exclude files in this list
             exclusion_list = ['.git']
 
+            docker_ignore = os.path.join(context_path, '.dockerignore')
+            if os.path.exists(docker_ignore):
+                for line in open(docker_ignore).readlines():
+                    if line.strip()[0] is not '#':
+                        exclusion_list.append(line.strip().rstrip('\/'))
+            LOG.info("Exclusion list: %s" % exclusion_list)
+
             # see docker-py source for context
             for path in sorted(
                     DockerUtils.exclude_paths(context_path, exclusion_list)):