setup ConanProfiles + reduce layers
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user