From cba4d932b56b4fe185a590ff8c8ce3b8cd4b5d46 Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Wed, 28 Jan 2026 12:22:32 +0800 Subject: [PATCH 1/2] [CI] Optimize docker build to fix disk space issues --- .github/workflows/docker-build.yml | 7 +++++ scripts/Dockerfile | 41 ++++++++++++++---------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 451d428e..90b5e423 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -18,6 +18,13 @@ jobs: image-tag: ${{ steps.format-tag.outputs.tag }} steps: + - name: Free up disk space + run: | + sudo apt-get clean + sudo apt-get autoremove -y + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc + df -h + - name: Checkout code uses: actions/checkout@v4 diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 447dbde7..4341e3af 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -50,28 +50,25 @@ RUN apt-get update && apt-get install -y \ WORKDIR /gcc-build RUN git clone --depth 1 --branch "releases/gcc-${GCC_VERSION}" --single-branch \ - https://mirrors.tuna.tsinghua.edu.cn/git/gcc.git gcc-source - -WORKDIR /gcc-build/gcc-source - -RUN mkdir -p /gcc-build/gcc-build -WORKDIR /gcc-build/gcc-build - -RUN ../gcc-source/configure \ - --disable-multilib \ - --enable-languages=c,c++,fortran \ - --prefix=/usr/local \ - && make -j$(nproc) \ - && make install + https://mirrors.tuna.tsinghua.edu.cn/git/gcc.git gcc-source && \ + mkdir -p gcc-build && \ + cd gcc-build && \ + ../gcc-source/configure \ + --disable-multilib \ + --enable-languages=c,c++,fortran \ + --prefix=/usr/local && \ + make -j$(nproc) && \ + make install && \ + cd / && \ + rm -rf /gcc-build WORKDIR /llvm-build -RUN git clone --depth 1 --branch "llvmorg-${LLVM_VERSION}" --single-branch \ - https://mirrors.tuna.tsinghua.edu.cn/git/llvm-project.git llvm-project -RUN mkdir -p /llvm-build/build -WORKDIR /llvm-build/build - -RUN cmake -G Ninja \ +RUN git clone --depth 1 --branch "llvmorg-${LLVM_VERSION}" --single-branch \ + https://mirrors.tuna.tsinghua.edu.cn/git/llvm-project.git llvm-project && \ + mkdir -p build && \ + cd build && \ + cmake -G Ninja \ -DLLVM_ENABLE_PROJECTS="clang;lld;flang" \ -DLLVM_ENABLE_RTTI=ON \ -DLLVM_ENABLE_CXX_STD=ON \ @@ -83,7 +80,9 @@ RUN cmake -G Ninja \ -DCMAKE_INSTALL_PREFIX=/usr/local \ ../llvm-project/llvm && \ ninja && \ - ninja install + ninja install && \ + cd / && \ + rm -rf /llvm-build ENV PATH="/usr/local/bin:${PATH}" ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64" @@ -105,8 +104,6 @@ RUN echo "=== GCC ===" && \ echo "Flang version: $(flang --version | head -n1)" WORKDIR / -RUN rm -rf /gcc-build /llvm-build - WORKDIR /workspace LABEL maintainer="luohaothu" From 10f3b7d95d9eb1f7ba0e976235e6fe7090985812 Mon Sep 17 00:00:00 2001 From: Luohao Wang Date: Wed, 28 Jan 2026 12:35:06 +0800 Subject: [PATCH 2/2] [CI] Fix WORKDIR issue --- scripts/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 4341e3af..b52ff070 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -84,6 +84,8 @@ RUN git clone --depth 1 --branch "llvmorg-${LLVM_VERSION}" --single-branch \ cd / && \ rm -rf /llvm-build +WORKDIR / + ENV PATH="/usr/local/bin:${PATH}" ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64" ENV CC=gcc @@ -103,7 +105,6 @@ RUN echo "=== GCC ===" && \ echo "Clang version: $(clang --version | head -n1)" && \ echo "Flang version: $(flang --version | head -n1)" -WORKDIR / WORKDIR /workspace LABEL maintainer="luohaothu"