This commit is contained in:
parent
b6761ad62b
commit
51700a364e
@ -21,15 +21,15 @@ RUN apk add --no-cache \
|
|||||||
libdwarf-dev
|
libdwarf-dev
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /build
|
WORKDIR /app
|
||||||
|
|
||||||
COPY CMakeLists.txt cmake_prebuild.sh ./
|
COPY . .
|
||||||
#COPY cmake ./cmake
|
|
||||||
COPY src/version.hpp.in ./src/version.hpp.in
|
|
||||||
|
|
||||||
# Configure and build with ccache
|
# Configure and build with ccache
|
||||||
RUN mkdir -p build_static && \
|
RUN --mount=type=cache,target=/build \
|
||||||
cmake -G Ninja -B build_static -DCMAKE_BUILD_TYPE=Debug \
|
mkdir -p build_static && \
|
||||||
|
cmake -G Ninja -B build_static \
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug \
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||||
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold -static" \
|
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold -static" \
|
||||||
@ -44,16 +44,13 @@ RUN mkdir -p build_static && \
|
|||||||
|
|
||||||
|
|
||||||
# Explicitly build dependencies first (cached separately)
|
# 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
|
RUN --mount=type=cache,target=/build cmake --build /build
|
||||||
COPY src ./build_static/src
|
|
||||||
|
|
||||||
RUN cmake --build build_static
|
|
||||||
|
|
||||||
# Final stage that only contains the binary
|
# Final stage that only contains the binary
|
||||||
FROM scratch AS project
|
FROM scratch AS project
|
||||||
|
|
||||||
ARG 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