diff --git a/Dockerfile.dropshell-build b/Dockerfile.dropshell-build index 8f858bd..3d9aa97 100644 --- a/Dockerfile.dropshell-build +++ b/Dockerfile.dropshell-build @@ -6,10 +6,20 @@ ARG CMAKE_BUILD_TYPE=Debug # Set working directory WORKDIR /app +# Create cache directories +RUN mkdir -p /ccache /build-cache + +# Set up ccache +ENV CCACHE_DIR=/ccache +ENV CCACHE_COMPILERCHECK=content +ENV CCACHE_MAXSIZE=2G + COPY . . -# Configure and build with ccache -RUN mkdir -p /build && \ +# Configure and build with ccache using cache mounts +RUN --mount=type=cache,target=/ccache \ + --mount=type=cache,target=/build \ + mkdir -p /build && \ cmake -G Ninja -S /app -B /build \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ @@ -29,14 +39,18 @@ RUN mkdir -p /build && \ -DOPENSSL_INCLUDE_DIR=/usr/local/include \ ${CMAKE_TOOLCHAIN_FILE:+-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE} +# Build with cache mounts +RUN --mount=type=cache,target=/ccache \ + --mount=type=cache,target=/build \ + cmake --build /build --target run_prebuild_script -# Explicitly build dependencies first -RUN cmake --build /build --target run_prebuild_script - -RUN cmake --build /build +RUN --mount=type=cache,target=/ccache \ + --mount=type=cache,target=/build \ + cmake --build /build # Copy the built executable to a regular directory for the final stage -RUN mkdir -p /output && \ +RUN --mount=type=cache,target=/build \ + mkdir -p /output && \ find /build -type f -executable -name "*${PROJECT}*" -exec cp {} /output/${PROJECT} \; || \ find /build -type f -executable -exec cp {} /output/${PROJECT} \; diff --git a/build.sh b/build.sh index e3b09fa..54a9606 100755 --- a/build.sh +++ b/build.sh @@ -11,6 +11,10 @@ rm -rf "${SCRIPT_DIR}/output" mkdir -p "${SCRIPT_DIR}/output" PROJECT="simple-object-server" + +# Enable Docker buildkit for cache support +export DOCKER_BUILDKIT=1 + docker build \ -t "gitea.jde.nz/public/${PROJECT}-build:latest" \ -f "${SCRIPT_DIR}/Dockerfile.dropshell-build" \ diff --git a/src/config.cpp b/src/config.cpp index be9768f..42e4829 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -78,7 +78,7 @@ bool load_config(const std::string& config_path, ServerConfig& config) { } } - ASSERT(config.object_store_path.empty(), "object_store_path is not empty"); + // Test incremental build comment return true; } catch (const std::exception& e) {