Fixing docker build for race and profiling images
Change-Id: I6b28d5ff8e452ccb96016302f9c2dc70baacb695
diff --git a/Makefile b/Makefile
index 2597c38..c14bbbf 100644
--- a/Makefile
+++ b/Makefile
@@ -89,10 +89,12 @@
docker-build: local-protos local-lib-go ## Build core docker image (set BUILD_PROFILED=true to also build the profiled image)
docker build $(DOCKER_BUILD_ARGS) -t ${RWCORE_IMAGENAME}:${DOCKER_TAG} --target ${DOCKER_TARGET} -f docker/Dockerfile.rw_core .
ifdef BUILD_PROFILED
- docker build $(DOCKER_BUILD_ARGS) --target ${DOCKER_TARGET} --build-arg EXTRA_GO_BUILD_TAGS="-tags profile" -t ${RWCORE_IMAGENAME}:${DOCKER_TAG}-profile -f docker/Dockerfile.rw_core .
+# Force target to dev as profile build must be built with dynamic linking
+ docker build $(DOCKER_BUILD_ARGS) --target dev --build-arg EXTRA_GO_BUILD_TAGS="-tags profile" --build-arg CGO_PARAMETER="CGO_ENABLED=1" -t ${RWCORE_IMAGENAME}:${DOCKER_TAG}-profile -f docker/Dockerfile.rw_core .
endif
ifdef BUILD_RACE
- docker build $(DOCKER_BUILD_ARGS) --target ${DOCKER_TARGET} --build-arg GOLANG_IMAGE=golang:1.13.8-buster --build-arg DEPLOY_IMAGE=debian:buster-slim --build-arg EXTRA_GO_BUILD_TAGS="--race" -t ${RWCORE_IMAGENAME}:${DOCKER_TAG}-rd -f docker/Dockerfile.rw_core .
+# Force target to dev as race detection build must be built with dynamic linking
+ docker build $(DOCKER_BUILD_ARGS) --target dev --build-arg GOLANG_IMAGE=golang:1.13.8-buster --build-arg CGO_PARAMETER="CGO_ENABLED=1" --build-arg DEPLOY_IMAGE=debian:buster-slim --build-arg EXTRA_GO_BUILD_TAGS="--race" -t ${RWCORE_IMAGENAME}:${DOCKER_TAG}-rd -f docker/Dockerfile.rw_core .
endif
docker-push: ## Push the docker images to an external repository
diff --git a/VERSION b/VERSION
index c8e38b6..dedcc7d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.9.0
+2.9.1
diff --git a/docker/Dockerfile.rw_core b/docker/Dockerfile.rw_core
index b63c3e1..15f0ad7 100644
--- a/docker/Dockerfile.rw_core
+++ b/docker/Dockerfile.rw_core
@@ -34,6 +34,8 @@
ARG EXTRA_GO_BUILD_TAGS=""
+ARG CGO_PARAMETER="CGO_ENABLED=0"
+
ARG org_label_schema_version=unknown
ARG org_label_schema_vcs_url=unknown
ARG org_label_schema_vcs_ref=unknown
@@ -45,7 +47,7 @@
WORKDIR /go/src/rw_core
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN \
-CGO_ENABLED=0 go build $EXTRA_GO_BUILD_TAGS -mod=vendor -o /app/rw_core \
+export ${CGO_PARAMETER?} && go build $EXTRA_GO_BUILD_TAGS -mod=vendor -o /app/rw_core \
-ldflags \
"-X github.com/opencord/voltha-lib-go/v4/pkg/version.version=$org_label_schema_version \
-X github.com/opencord/voltha-lib-go/v4/pkg/version.vcsRef=$org_label_schema_vcs_ref \