|
| 1 | +# ----------------------------------------------------------- |
| 2 | +# Base Image with LLVM |
| 3 | +# ----------------------------------------------------------- |
| 4 | +FROM ubuntu:22.04 as ubuntu_llvm |
| 5 | +ENV DEBIAN_FRONTEND=noninteractive |
| 6 | + |
| 7 | +# update the system and install any dependencies |
| 8 | +RUN apt-get update \ |
| 9 | + && apt-get upgrade -y libksba-dev \ |
| 10 | + && apt-get install -y git cmake build-essential byacc libpcre3 libpcre3-dev grep lsb-release wget software-properties-common gnupg libcurl4-openssl-dev unzip lcov --no-install-recommends # skipcq: DOK-DL3018 |
| 11 | + |
| 12 | +# Get LLVM |
| 13 | +ARG LLVM_VER=15 |
| 14 | +RUN wget --no-verbose https://apt.llvm.org/llvm.sh |
| 15 | +RUN chmod +x ./llvm.sh \ |
| 16 | + && ./llvm.sh ${LLVM_VER} \ |
| 17 | + && apt-get -y install libclang-${LLVM_VER}-dev libclang-cpp${LLVM_VER}-dev --no-install-recommends \ |
| 18 | + && apt-get clean \ |
| 19 | + && rm -rf /var/lib/apt/lists/* |
| 20 | + |
| 21 | +# Add environment variables for build |
| 22 | +ENV PATH="$PATH:/usr/lib/llvm-${LLVM_VER}/bin" |
| 23 | +ENV LLVM_INSTALL_DIR "/usr/lib/llvm-${LLVM_VER}" |
| 24 | +ENV SENTRY_INSTALL_DIR="/usr/lib/sentry-sdk" |
| 25 | + |
| 26 | +# Get Sentry |
| 27 | +ARG SENTRY_TAG=0.6.3 |
| 28 | +RUN mkdir /sentry-sdk \ |
| 29 | + && cd /sentry-sdk \ |
| 30 | + && wget --no-verbose "https://github.com/getsentry/sentry-native/releases/download/${SENTRY_TAG}/sentry-native.zip" \ |
| 31 | + && unzip sentry-native.zip \ |
| 32 | + && cmake -B ./build \ |
| 33 | + && cmake --build ./build --parallel \ |
| 34 | + && cmake --install ./build --prefix "${SENTRY_INSTALL_DIR}" |
| 35 | + |
| 36 | +# Install spdlog |
| 37 | +RUN git clone --depth=1 --branch v1.11.0 https://github.com/gabime/spdlog.git \ |
| 38 | + && cd spdlog \ |
| 39 | + && cmake -B build \ |
| 40 | + && cmake --build build --parallel \ |
| 41 | + && cd build && make install |
| 42 | + |
| 43 | +# Install cppcheck |
| 44 | +RUN git clone --depth=1 --branch 2.10.3 https://github.com/danmar/cppcheck.git \ |
| 45 | + && cd cppcheck \ |
| 46 | + && cmake -B build -DHAVE_RULES=ON -DUSE_MATCHCOMPILER=ON -DCMAKE_BUILD_TYPE=RELEASE \ |
| 47 | + && cmake --build build --parallel 4 \ |
| 48 | + && cd build && make install |
| 49 | + |
| 50 | +# ----------------------------------------------------------- |
| 51 | +# End |
| 52 | +# ----------------------------------------------------------- |
| 53 | + |
| 54 | +FROM rust:slim-bookworm AS rs_builder |
| 55 | + |
| 56 | +RUN mkdir -p /code |
| 57 | +ADD . /code |
| 58 | +WORKDIR /code |
| 59 | + |
| 60 | +RUN cargo b --release |
| 61 | + |
| 62 | +FROM ubuntu_llvm |
| 63 | + |
| 64 | +RUN mkdir -p /toolbox |
| 65 | +COPY --from=rs_builder /code/target/release/cppcheck-deepsource /toolbox/ |
0 commit comments