build-setup.sh: new option to only build the container

Starting to see incompatibilities in the latest Ubuntu releases with
older levels of code so it will be useful to have a way to utilize this
script to build older Ubuntu release docker containers and then utilize
them on newer Ubuntu machines.

Tested:
- Verified the new env variable worked as expected
- Verified when the env variable is not set, code behaved as it used to

Change-Id: I95eb0ea1a1c52e0ef50390fa1978590024170bf5
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/build-setup.sh b/build-setup.sh
index 529cdad..fecf0dc 100755
--- a/build-setup.sh
+++ b/build-setup.sh
@@ -21,6 +21,8 @@
 #  ENV_LOCAL_CONF     [optional] The environment variables to inject into the
 #                     build, which will be written into local.conf.
 #                     default is empty.
+#  CONTAINER_ONLY     Set to "true" if you only want to build the docker
+#                     container. The bitbake will not occur in this case.
 #
 # Docker Image Build Variables:
 #  BITBAKE_OPTS       Set to "-c populate_sdk" or whatever other BitBake options
@@ -84,6 +86,7 @@
 num_cpu=${num_cpu:-$(nproc)}
 UBUNTU_MIRROR=${UBUNTU_MIRROR:-""}
 ENV_LOCAL_CONF=${ENV_LOCAL_CONF:-""}
+container_only=${CONTAINER_ONLY:-false}
 
 # Docker Image Build Variables:
 build_dir=${build_dir:-${WORKSPACE}/build}
@@ -407,6 +410,10 @@
 # Build the Docker image
 docker build --network=host -t "${img_name}" - <<< "${Dockerfile}"
 
+if [[ "$container_only" = "true" ]]; then
+    exit 0
+fi
+
 # If obmc_dir or ssc_dir are ${HOME} or a subdirectory they will not be mounted
 mount_obmc_dir="-v ""${obmc_dir}"":""${obmc_dir}"" "
 mount_ssc_dir="-v ""${ssc_dir}"":""${ssc_dir}"" "