# Build arguments ARG BASE_BUILDER ARG CONAN_PROFILE_BRANCH # Base image FROM $BASE_BUILDER # Environment variables for ccache and pipx ENV CCACHE_DIR=/ccache \ CCACHE_COMPRESS=1 \ CCACHE_MAXSIZE=10G \ CCACHE_COMPILERCHECK=content \ PATH=/root/.local/bin:$PATH # Install system dependencies, clang, and pipx RUN apt-get update && apt-get install -y \ build-essential \ ccache \ cmake \ ninja-build \ git \ pkg-config \ wget \ lsb-release \ software-properties-common \ pipx \ && rm -rf /var/lib/apt/lists/* \ \ # Install LLVM 18 && wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh \ && chmod +x /tmp/llvm.sh \ && /tmp/llvm.sh 18 all \ && apt-get install -y clang-tools-18 \ \ # Symlinks for clang 18 tools && ln -sf /usr/bin/clang-18 /usr/bin/clang \ && ln -sf /usr/bin/clang++-18 /usr/bin/clang++ \ && ln -sf /usr/bin/llvm-profdata-18 /usr/bin/llvm-profdata \ && ln -sf /usr/bin/llvm-cov-18 /usr/bin/llvm-cov \ && ln -sf /usr/bin/clang-format-18 /usr/bin/clang-format \ && ln -sf /usr/bin/clang-tidy-18 /usr/bin/clang-tidy \ && ln -sf /usr/bin/llvm-ar-18 /usr/bin/llvm-ar \ && ln -sf /usr/bin/llvm-nm-18 /usr/bin/llvm-nm \ && ln -sf /usr/bin/llvm-ranlib-18 /usr/bin/llvm-ranlib \ \ # Reset ccache stats && ccache --zero-stats # Install pipx and Conan RUN pipx ensurepath \ && pipx install conan # Build and install mold RUN git clone --branch v2.40.4 https://github.com/rui314/mold.git /tmp/mold \ && cd /tmp/mold \ && ./install-build-deps.sh \ && cmake . -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -B build \ && cmake --build build -j$(nproc) \ && cmake --install build \ && rm -rf /tmp/mold RUN echo "$CONAN_PROFILE_BRANCH" # Configure Conan with custom profiles and remote RUN conan config install https://git.romainboullard.com/BigfootDev/ConanProfiles.git --args=--branch $CONAN_PROFILE_BRANCH \ && conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/bigfootpackages \ && conan remote disable conancenter # Show ccache stats (optional, for debugging) RUN ccache --show-stats