'Generic Commit'
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 17s
Build-Test-Publish / build (linux/arm64) (push) Failing after 25s
Build-Test-Publish / create-manifest (push) Has been skipped

This commit is contained in:
Your Name
2025-06-15 16:40:43 +12:00
parent bf9f714a3d
commit de99ef0d11
3 changed files with 64 additions and 4 deletions

View File

@@ -15,9 +15,17 @@ ENV CCACHE_DIR=/ccache
ENV CCACHE_COMPILERCHECK=content
ENV CCACHE_MAXSIZE=2G
COPY . .
# Copy only build files first (for better layer caching)
COPY CMakeLists.txt cmake_prebuild.sh ./
COPY src/version.hpp.in src/
# Configure and build with ccache using cache mounts
# Run prebuild script early (this rarely changes)
RUN bash cmake_prebuild.sh
# Copy source files (this invalidates cache when source changes)
COPY src/ src/
# Configure project (this step is cached unless CMakeLists.txt changes)
RUN --mount=type=cache,target=/ccache \
--mount=type=cache,target=/build \
mkdir -p /build && \
@@ -38,11 +46,12 @@ RUN --mount=type=cache,target=/ccache \
-DOPENSSL_INCLUDE_DIR=/usr/local/include \
${CMAKE_TOOLCHAIN_FILE:+-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE}
# Build with cache mounts
# Run prebuild script
RUN --mount=type=cache,target=/ccache \
--mount=type=cache,target=/build \
cmake --build /build --target run_prebuild_script
# Build project (ccache will help here when only some files change)
RUN --mount=type=cache,target=/ccache \
--mount=type=cache,target=/build \
cmake --build /build