diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 56a7e83..21d6588 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -70,7 +70,7 @@ jobs: password: ${{ secrets.CI_TOKEN }} - name: Build Builder - run: docker build -t "$CPP_BUILDER_TAG" ./Linux/CPPBuilder --build-arg BASE_BUILDER="$BASE_BUILDER_TAG" + run: docker build -t "$CPP_BUILDER_TAG" ./Linux/CPPBuilder --build-arg BASE_BUILDER="$BASE_BUILDER_TAG" --build-arg CONAN_PROFILE_BRANCH=${{ github.ref_name }} - name: Push Builder run: docker push "$CPP_BUILDER_TAG" \ No newline at end of file diff --git a/Linux/BaseBuilder/Dockerfile b/Linux/BaseBuilder/Dockerfile index e3de30b..39ceb4b 100644 --- a/Linux/BaseBuilder/Dockerfile +++ b/Linux/BaseBuilder/Dockerfile @@ -1,17 +1,28 @@ FROM ubuntu:24.04 -ENV TZ=Europe/Paris -ENV DEBIAN_FRONTEND=noninteractive -ENV PATH="/root/.local/bin:$PATH" +# Set timezone, noninteractive mode, and pipx path +ENV TZ=Europe/Paris \ + DEBIAN_FRONTEND=noninteractive \ + PATH="/root/.local/bin:$PATH" +# Use build cache for ccache RUN --mount=type=cache,target=/ccache -# Make sudo dummy replacement, so we don't weaken docker security -RUN echo "#!/bin/bash\n\$@" > /usr/bin/sudo -RUN chmod +x /usr/bin/sudo +# Dummy sudo (no security weakening) +RUN echo '#!/bin/bash\n$@' > /usr/bin/sudo \ + && chmod +x /usr/bin/sudo -RUN apt-get update -y -RUN apt-get install -y +# Install base dependencies in one layer +RUN apt-get update && apt-get install -y --no-install-recommends \ + unzip \ + curl \ + wget \ + lsb-release \ + software-properties-common \ + gnupg \ + python3 \ + python3-pip \ + && rm -rf /var/lib/apt/lists/* -RUN apt-get install unzip curl wget lsb-release software-properties-common gnupg -y -RUN apt-get install python3 -y \ No newline at end of file +# Optional: Upgrade pip for Python3 +RUN python3 -m pip install --no-cache-dir --upgrade pip diff --git a/Linux/CPPBuilder/Dockerfile b/Linux/CPPBuilder/Dockerfile index a7b173e..5e05eed 100644 --- a/Linux/CPPBuilder/Dockerfile +++ b/Linux/CPPBuilder/Dockerfile @@ -1,49 +1,73 @@ +# Build arguments ARG BASE_BUILDER +ARG CONAN_PROFILE_BRANCH +# Base image FROM $BASE_BUILDER -ENV CCACHE_DIR=/ccache -ENV CCACHE_COMPRESS=1 -ENV CCACHE_MAXSIZE=10G -ENV CCACHE_COMPILERCHECK=content +# Environment variables for ccache and pipx +ENV CCACHE_DIR=/ccache \ + CCACHE_COMPRESS=1 \ + CCACHE_MAXSIZE=10G \ + CCACHE_COMPILERCHECK=content \ + PATH=/root/.local/bin:$PATH -RUN apt-get install build-essential -y -RUN apt-get install ccache -y -RUN apt-get install cmake -y -RUN apt-get install ninja-build -y -RUN apt-get install git -y -RUN apt-get install pkg-config -y +# 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 \ + python3-pip \ + && 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 -RUN wget https://apt.llvm.org/llvm.sh && \ - chmod +x llvm.sh && \ - ./llvm.sh 18 all -RUN apt-get install clang-tools-18 -y +# Install pipx and Conan +RUN python3 -m pip install --no-cache-dir pipx \ + && pipx ensurepath \ + && pipx install conan -RUN ln -s /bin/clang-18 /bin/clang -RUN ln -s /bin/clang++-18 /bin/clang++ -RUN ln -s /usr/bin/llvm-profdata-18 /usr/bin/llvm-profdata -RUN ln -s /usr/bin/llvm-cov-18 /usr/bin/llvm-cov -RUN ln -s /usr/bin/clang-format-18 /usr/bin/clang-format -RUN ln -s /usr/bin/clang-tidy-18 /usr/bin/clang-tidy -RUN ln -s /usr/bin/llvm-ar-18 /usr/bin/llvm-ar -RUN ln -s /usr/bin/llvm-nm-18 /usr/bin/llvm-nm -RUN ln -s /usr/bin/llvm-ranlib-18 /usr/bin/llvm-ranlib +# 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 ccache --zero-stats +# Configure Conan with custom profiles and remote +RUN conan config install https://git.romainboullard.com/BigfootDev/ConanProfiles.git --args="--branch ${CONAN_PROFILE_BRANCH}" --force \ + && 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 - -RUN apt-get install pipx -y -RUN pipx ensurepath - -RUN git clone --branch v2.40.4 https://github.com/rui314/mold.git -RUN mold/install-build-deps.sh -RUN cmake mold -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -B mold/build -RUN cmake --build mold/build -j$(nproc) -RUN cmake --build mold/build --target install - -RUN pipx install conan - -RUN conan config install https://gitlab.com/bigfootdev/config/conan.git -RUN conan remote add bigfootpackages https://packages.bigfootengine.com/artifactory/api/conan/bigfootpackages -RUN conan remote disable conancenter \ No newline at end of file