This commit is contained in:
parent
b6761ad62b
commit
51700a364e
@ -21,15 +21,15 @@ RUN apk add --no-cache \
|
||||
libdwarf-dev
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /build
|
||||
WORKDIR /app
|
||||
|
||||
COPY CMakeLists.txt cmake_prebuild.sh ./
|
||||
#COPY cmake ./cmake
|
||||
COPY src/version.hpp.in ./src/version.hpp.in
|
||||
COPY . .
|
||||
|
||||
# Configure and build with ccache
|
||||
RUN mkdir -p build_static && \
|
||||
cmake -G Ninja -B build_static -DCMAKE_BUILD_TYPE=Debug \
|
||||
RUN --mount=type=cache,target=/build \
|
||||
mkdir -p build_static && \
|
||||
cmake -G Ninja -B build_static \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold -static" \
|
||||
@ -44,16 +44,13 @@ RUN mkdir -p build_static && \
|
||||
|
||||
|
||||
# Explicitly build dependencies first (cached separately)
|
||||
RUN cmake --build build_static --target run_prebuild_script
|
||||
RUN --mount=type=cache,target=/build cmake --build /build --target run_prebuild_script
|
||||
|
||||
# Copy source files
|
||||
COPY src ./build_static/src
|
||||
|
||||
RUN cmake --build build_static
|
||||
RUN --mount=type=cache,target=/build cmake --build /build
|
||||
|
||||
# Final stage that only contains the binary
|
||||
FROM scratch AS project
|
||||
|
||||
ARG PROJECT
|
||||
|
||||
COPY --from=builder /build/build_static/${PROJECT} /${PROJECT}
|
||||
COPY --from=builder /build/${PROJECT} /${PROJECT}
|
||||
|
Loading…
x
Reference in New Issue
Block a user