setup ConanProfiles + reduce layers
Some checks failed
Docker Builders / build-base-builder (push) Failing after 28s
Docker Builders / build-cpp-builder (push) Failing after 46s

This commit is contained in:
2026-01-23 17:42:33 +01:00
parent 784a8fd106
commit 3074d39213
3 changed files with 85 additions and 50 deletions

View File

@@ -70,7 +70,7 @@ jobs:
password: ${{ secrets.CI_TOKEN }} password: ${{ secrets.CI_TOKEN }}
- name: Build Builder - 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 - name: Push Builder
run: docker push "$CPP_BUILDER_TAG" run: docker push "$CPP_BUILDER_TAG"

View File

@@ -1,17 +1,28 @@
FROM ubuntu:24.04 FROM ubuntu:24.04
ENV TZ=Europe/Paris # Set timezone, noninteractive mode, and pipx path
ENV DEBIAN_FRONTEND=noninteractive ENV TZ=Europe/Paris \
ENV PATH="/root/.local/bin:$PATH" DEBIAN_FRONTEND=noninteractive \
PATH="/root/.local/bin:$PATH"
# Use build cache for ccache
RUN --mount=type=cache,target=/ccache RUN --mount=type=cache,target=/ccache
# Make sudo dummy replacement, so we don't weaken docker security # Dummy sudo (no security weakening)
RUN echo "#!/bin/bash\n\$@" > /usr/bin/sudo RUN echo '#!/bin/bash\n$@' > /usr/bin/sudo \
RUN chmod +x /usr/bin/sudo && chmod +x /usr/bin/sudo
RUN apt-get update -y # Install base dependencies in one layer
RUN apt-get install -y 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 # Optional: Upgrade pip for Python3
RUN apt-get install python3 -y RUN python3 -m pip install --no-cache-dir --upgrade pip

View File

@@ -1,49 +1,73 @@
# Build arguments
ARG BASE_BUILDER ARG BASE_BUILDER
ARG CONAN_PROFILE_BRANCH
# Base image
FROM $BASE_BUILDER FROM $BASE_BUILDER
ENV CCACHE_DIR=/ccache # Environment variables for ccache and pipx
ENV CCACHE_COMPRESS=1 ENV CCACHE_DIR=/ccache \
ENV CCACHE_MAXSIZE=10G CCACHE_COMPRESS=1 \
ENV CCACHE_COMPILERCHECK=content CCACHE_MAXSIZE=10G \
CCACHE_COMPILERCHECK=content \
PATH=/root/.local/bin:$PATH
RUN apt-get install build-essential -y # Install system dependencies, clang, and pipx
RUN apt-get install ccache -y RUN apt-get update && apt-get install -y \
RUN apt-get install cmake -y build-essential \
RUN apt-get install ninja-build -y ccache \
RUN apt-get install git -y cmake \
RUN apt-get install pkg-config -y 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 && \ # Install pipx and Conan
chmod +x llvm.sh && \ RUN python3 -m pip install --no-cache-dir pipx \
./llvm.sh 18 all && pipx ensurepath \
RUN apt-get install clang-tools-18 -y && pipx install conan
RUN ln -s /bin/clang-18 /bin/clang # Build and install mold
RUN ln -s /bin/clang++-18 /bin/clang++ RUN git clone --branch v2.40.4 https://github.com/rui314/mold.git /tmp/mold \
RUN ln -s /usr/bin/llvm-profdata-18 /usr/bin/llvm-profdata && cd /tmp/mold \
RUN ln -s /usr/bin/llvm-cov-18 /usr/bin/llvm-cov && ./install-build-deps.sh \
RUN ln -s /usr/bin/clang-format-18 /usr/bin/clang-format && cmake . -DCMAKE_BUILD_TYPE=Release \
RUN ln -s /usr/bin/clang-tidy-18 /usr/bin/clang-tidy -DCMAKE_CXX_COMPILER=clang++ \
RUN ln -s /usr/bin/llvm-ar-18 /usr/bin/llvm-ar -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
RUN ln -s /usr/bin/llvm-nm-18 /usr/bin/llvm-nm -DCMAKE_C_COMPILER_LAUNCHER=ccache \
RUN ln -s /usr/bin/llvm-ranlib-18 /usr/bin/llvm-ranlib -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 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