[VOL-2993] Adding environment variable support to easily build profiled image

Change-Id: I8c4fc2e844b69e95fdffc181ec7f51a3d96493c6
diff --git a/Makefile b/Makefile
index 2d7c17e..82505a3 100644
--- a/Makefile
+++ b/Makefile
@@ -103,10 +103,10 @@
 docker-build-profile: rw_core_profile
 
 rw_core: local-protos local-lib-go
-	docker build $(DOCKER_BUILD_ARGS) -t ${RWCORE_IMAGENAME}:${DOCKER_TAG} -t ${RWCORE_IMAGENAME}:latest -f docker/Dockerfile.rw_core .
-
-rw_core_profile: local-protos local-lib-go
-	docker build $(DOCKER_BUILD_ARGS) --build-arg EXTRA_GO_BUILD_TAGS="-tags profile" -t ${RWCORE_IMAGENAME}:${DOCKER_TAG}-profile -t ${RWCORE_IMAGENAME}:latest-profile -f docker/Dockerfile.rw_core .
+	docker build $(DOCKER_BUILD_ARGS) -t ${RWCORE_IMAGENAME}:${DOCKER_TAG} -f docker/Dockerfile.rw_core .
+ifdef BUILD_PROFILED
+	docker build $(DOCKER_BUILD_ARGS) --build-arg EXTRA_GO_BUILD_TAGS="-tags profile" -t ${RWCORE_IMAGENAME}:${DOCKER_TAG}-profile -f docker/Dockerfile.rw_core .
+endif
 
 docker-push:
 	docker push ${RWCORE_IMAGENAME}:${DOCKER_TAG}