?
This commit is contained in:
@ -27,8 +27,8 @@ COPY . .
|
||||
|
||||
# Configure and build with ccache
|
||||
RUN --mount=type=cache,target=/build \
|
||||
mkdir -p build_static && \
|
||||
cmake -G Ninja -B build_static \
|
||||
mkdir -p /build && \
|
||||
cmake -G Ninja -S /app -B /build \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
@ -48,9 +48,15 @@ RUN --mount=type=cache,target=/build cmake --build /build --target run_prebuild_
|
||||
|
||||
RUN --mount=type=cache,target=/build cmake --build /build
|
||||
|
||||
# Copy the built executable to a regular directory for the final stage
|
||||
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} \;
|
||||
|
||||
# Final stage that only contains the binary
|
||||
FROM scratch AS project
|
||||
FROM alpine:latest AS project
|
||||
|
||||
ARG PROJECT
|
||||
|
||||
COPY --from=builder /build/${PROJECT} /${PROJECT}
|
||||
# Copy the actual binary from the regular directory
|
||||
COPY --from=builder /output/ /output/
|
||||
|
Reference in New Issue
Block a user