lordgamez commented on a change in pull request #1164:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1164#discussion_r694075455



##########
File path: docker/DockerBuild.sh
##########
@@ -133,14 +136,28 @@ if [ -n "${BUILD_NUMBER}" ]; then
   TARGZ_TAG="${TARGZ_TAG}-${BUILD_NUMBER}"
 fi
 
-DOCKER_COMMAND="docker build "
+DOCKER_BUILD_START="docker build "
 BUILD_ARGS="--build-arg UID=${UID_ARG} \
             --build-arg GID=${GID_ARG} \
             --build-arg MINIFI_VERSION=${MINIFI_VERSION} \
             --build-arg DUMP_LOCATION=${DUMP_LOCATION} \
             --build-arg DISTRO_NAME=${DISTRO_NAME} ${BUILD_ARGS}"
 
-DOCKER_COMMAND="${DOCKER_COMMAND} ${BUILD_ARGS} \
+if [ -n "${DOCKER_CCACHE_DUMP_LOCATION}" ]; then
+  DOCKER_COMMAND="${DOCKER_BUILD_START} ${BUILD_ARGS} \
+                -f ${DOCKERFILE} \
+                --target build \
+                -t \
+                minifi_build .."
+  echo "Build image Docker Command: 'DOCKER_BUILDKIT=1 ${DOCKER_COMMAND}'"
+  DOCKER_BUILDKIT=1 ${DOCKER_COMMAND}
+  container_id=$(docker run --rm -d  minifi_build sh -c "while true; do sleep 
1; done")
+  mkdir -p "${DOCKER_CCACHE_DUMP_LOCATION}"
+  docker cp "${container_id}:/home/minificpp/.ccache/." 
"${DOCKER_CCACHE_DUMP_LOCATION}"

Review comment:
       The problem with mounting is that is causes permission errors, because 
the userid of the host differ from the userid used in the container and if we 
mount the directory the files are copied to mounted directory with the userid 
and groupid of the container user (and we would also have to change the 
permissions of the directory to be able to copy there). With `docker cp` we 
don't have this problem.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to