szaszm commented on a change in pull request #1164:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1164#discussion_r694050187
##########
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:
Shouldn't we volume mount the host $HOME/.ccache to the container
instead? We could avoid the sleep hack and the copy this way.
##########
File path: docker/Dockerfile
##########
@@ -98,11 +99,15 @@ ENV MINIFI_VERSION ${MINIFI_VERSION}
# Setup minificpp user
RUN addgroup -g ${GID} ${USER} && adduser -u ${UID} -D -G ${USER} -g ""
${USER} && \
- install -d -o ${USER} -g ${USER} ${MINIFI_BASE_DIR}
+ install -d -o ${USER} -g ${USER} ${MINIFI_BASE_DIR} && \
+ ln -s $(which ccache) /usr/local/bin/gcc && \
+ ln -s $(which ccache) /usr/local/bin/g++
Review comment:
This shouldn't be needed. Our CMakeLists.txt (line 141) is looking for
ccache and using it if available, even if the compiler binaries are not
symlinks to ccache itself.
--
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]