From 95e43febb5f35e0974f4784ad000ff6a76cec319 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 23 Jun 2025 15:14:11 +0200 Subject: [PATCH 1/2] ci : reduce musa image size This commit contains an attempt to reduce the size of the musa Docker image by copying only the necessary files from the build stage. The motivation for this is that the CI runs sometimes fail with out of memory errors. These seems to be able to pass for PRs, at least sometimes but fail upon push to the master branch. --- .devops/main-musa.Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.devops/main-musa.Dockerfile b/.devops/main-musa.Dockerfile index c8b7ec287a4..03bd7fca452 100644 --- a/.devops/main-musa.Dockerfile +++ b/.devops/main-musa.Dockerfile @@ -26,6 +26,11 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* /var/tmp/* -COPY --from=build /app /app -ENV PATH=/app/build/bin:$PATH +#COPY --from=build /app /app +COPY --from=build /app/build/bin /app/bin +COPY --from=build /app/models /app/models +COPY --from=build /app/samples /app/samples +RUN du -sh /app/* +RUN find /app -type f -size +100M +ENV PATH=/app/bin:$PATH ENTRYPOINT [ "bash", "-c" ] From 9cb35d3941ef70e96e4c8bf4196abc0beda8806c Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 23 Jun 2025 16:38:24 +0200 Subject: [PATCH 2/2] ci : remove build time files instead of selective copying --- .devops/main-musa.Dockerfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.devops/main-musa.Dockerfile b/.devops/main-musa.Dockerfile index 03bd7fca452..bbc33993881 100644 --- a/.devops/main-musa.Dockerfile +++ b/.devops/main-musa.Dockerfile @@ -18,6 +18,12 @@ COPY .. . # Enable muBLAS RUN make base.en CMAKE_ARGS="-DGGML_MUSA=1" +RUN find /app/build -name "*.o" -delete && \ + find /app/build -name "*.a" -delete && \ + rm -rf /app/build/CMakeFiles && \ + rm -rf /app/build/cmake_install.cmake && \ + rm -rf /app/build/_deps + FROM ${BASE_MUSA_RUN_CONTAINER} AS runtime WORKDIR /app @@ -26,11 +32,8 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* /var/tmp/* -#COPY --from=build /app /app -COPY --from=build /app/build/bin /app/bin -COPY --from=build /app/models /app/models -COPY --from=build /app/samples /app/samples +COPY --from=build /app /app RUN du -sh /app/* RUN find /app -type f -size +100M -ENV PATH=/app/bin:$PATH +ENV PATH=/app/build/bin:$PATH ENTRYPOINT [ "bash", "-c" ]