1- # cppcheck builder
2- FROM debian:bookworm-slim AS cppcheck-builder
3- ARG CPPCHECK_VERSION=2.13.0
4- RUN set -ex; \
5- apt-get update && apt-get install -y --no-install-recommends \
6- curl \
7- ca-certificates \
8- cmake \
9- make \
10- g++ \
11- && rm -rf /var/lib/apt/lists/*; \
12- echo "Downloading Cppcheck version: ${CPPCHECK_VERSION}" ; \
13- curl -fL "https://github.com/danmar/cppcheck/archive/${CPPCHECK_VERSION}.tar.gz" -o /tmp/cppcheck.tar.gz; \
14- mkdir -p /src/cppcheck && tar -xzf /tmp/cppcheck.tar.gz -C /src/cppcheck --strip-components=1; \
15- rm /tmp/cppcheck.tar.gz; \
16- cd /src/cppcheck; \
17- mkdir build && cd build && cmake .. && cmake --build . -j"$(nproc)" ; \
18- strip bin/cppcheck
19-
20- # Final Image
21- FROM ubuntu:noble
22- COPY --from=cppcheck-builder /src/cppcheck/build/bin/cppcheck /usr/local/bin/cppcheck
23- COPY --from=cppcheck-builder /src/cppcheck/cfg /usr/local/share/Cppcheck/cfg
1+ # syntax = devthefuture/dockerfile-x
242
25- # Set Path
26- ENV PATH="/usr/local/bin:${PATH}"
3+ FROM ./ci-slim.Dockerfile
274
28- # Needed to prevent tzdata hanging while expecting user input
29- ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
30-
31- # Build and base stuff
32- # (zlib1g-dev is needed for the Qt host binary builds, but should not be used by target binaries)
33- ENV APT_ARGS="-y --no-install-recommends --no-upgrade"
5+ # The inherited Dockerfile switches to non-privileged context and we've
6+ # just started configuring this image, give us root access
7+ USER root
348
359# Install common packages
3610RUN set -ex; \
@@ -41,28 +15,18 @@ RUN set -ex; \
4115 autoconf \
4216 bear \
4317 bison \
44- build-essential \
4518 bsdmainutils \
46- curl \
4719 ccache \
4820 cmake \
49- g++ \
5021 gettext \
51- git \
5222 libtool \
5323 unzip \
5424 m4 \
5525 pkg-config \
56- zlib1g-dev \
5726 && rm -rf /var/lib/apt/lists/*
5827
59- # Install Clang+LLVM and set it as default
60- ARG LLVM_VERSION=18
28+ # Install Clang + LLVM and set it as default
6129RUN set -ex; \
62- echo "Installing LLVM and Clang ${LLVM_VERSION}..." ; \
63- . /etc/os-release; \
64- curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key > /etc/apt/trusted.gpg.d/apt.llvm.org.asc; \
65- echo "deb [signed-by=/etc/apt/trusted.gpg.d/apt.llvm.org.asc] http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-${LLVM_VERSION} main" > /etc/apt/sources.list.d/llvm.list; \
6630 apt-get update && apt-get install ${APT_ARGS} \
6731 "clang-${LLVM_VERSION}" \
6832 "clangd-${LLVM_VERSION}" \
@@ -73,8 +37,7 @@ RUN set -ex; \
7337 "libclang-${LLVM_VERSION}-dev" \
7438 "libclang-rt-${LLVM_VERSION}-dev" \
7539 "lld-${LLVM_VERSION}" \
76- "lldb-${LLVM_VERSION}" \
77- "llvm-${LLVM_VERSION}-dev" ; \
40+ "lldb-${LLVM_VERSION}" ; \
7841 rm -rf /var/lib/apt/lists/*; \
7942 echo "Setting defaults..." ; \
8043 lldbUpdAltArgs="update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${LLVM_VERSION} 100" ; \
@@ -88,48 +51,6 @@ RUN set -ex; \
8851# LD_LIBRARY_PATH is empty by default, this is the first entry
8952ENV LD_LIBRARY_PATH="/usr/lib/llvm-${LLVM_VERSION}/lib"
9053
91- # Python setup
92- # PYTHON_VERSION should match the value in .python-version
93- ARG PYTHON_VERSION=3.9.18
94- RUN apt-get update && apt-get install $APT_ARGS \
95- ca-certificates \
96- libbz2-dev \
97- libffi-dev \
98- liblzma-dev \
99- libncurses5-dev \
100- libncursesw5-dev \
101- libreadline-dev \
102- libsqlite3-dev \
103- libssl-dev \
104- make \
105- tk-dev \
106- xz-utils \
107- && rm -rf /var/lib/apt/lists/*
108-
109- ENV PYENV_ROOT="/usr/local/pyenv"
110- ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
111- RUN curl https://pyenv.run | bash \
112- && pyenv update \
113- && pyenv install $PYTHON_VERSION \
114- && pyenv global $PYTHON_VERSION \
115- && pyenv rehash
116- RUN pip3 install --no-cache-dir \
117- codespell==1.17.1 \
118- flake8==3.8.3 \
119- jinja2 \
120- lief==0.13.2 \
121- multiprocess \
122- mypy==0.910 \
123- pyzmq==22.3.0 \
124- vulture==2.3
125-
126- ARG DASH_HASH_VERSION=1.4.0
127- RUN set -ex; \
128- cd /tmp; \
129- git clone --depth 1 --no-tags --branch=${DASH_HASH_VERSION} https://github.com/dashpay/dash_hash; \
130- cd dash_hash && pip3 install -r requirements.txt .; \
131- cd .. && rm -rf dash_hash
132-
13354RUN set -ex; \
13455 git clone --depth=1 "https://github.com/include-what-you-use/include-what-you-use" -b "clang_${LLVM_VERSION}" /opt/iwyu; \
13556 cd /opt/iwyu; \
@@ -138,22 +59,6 @@ RUN set -ex; \
13859 make install -j "$(( $(nproc) - 1 ))" ; \
13960 cd /opt && rm -rf /opt/iwyu;
14061
141- ARG SHELLCHECK_VERSION=v0.7.1
142- RUN set -ex; \
143- curl -fL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" -o /tmp/shellcheck.tar.xz; \
144- mkdir -p /opt/shellcheck && tar -xf /tmp/shellcheck.tar.xz -C /opt/shellcheck --strip-components=1 && rm /tmp/shellcheck.tar.xz
145- ENV PATH="/opt/shellcheck:${PATH}"
146-
147- # Setup unprivileged user and configuration files
148- ARG USER_ID=1000 \
149- GROUP_ID=1000
150- RUN set -ex; \
151- groupmod -g ${GROUP_ID} -n dash ubuntu; \
152- usermod -u ${USER_ID} -md /home/dash -l dash ubuntu; \
153- mkdir -p /home/dash/.config/gdb; \
154- echo "add-auto-load-safe-path /usr/lib/llvm-${LLVM_VERSION}/lib" | tee /home/dash/.config/gdb/gdbinit; \
155- chown ${USER_ID}:${GROUP_ID} -R /home/dash
156-
15762# Packages needed for all target builds
15863RUN apt-get update && apt-get install $APT_ARGS \
15964 bc \
@@ -171,7 +76,6 @@ RUN apt-get update && apt-get install $APT_ARGS \
17176 wine-stable \
17277 wine64 \
17378 zip \
174- zstd \
17579 && rm -rf /var/lib/apt/lists/*
17680
17781# Make sure std::thread and friends is available
@@ -181,15 +85,11 @@ RUN \
18185 exit 0
18286
18387RUN \
184- mkdir -p /src/dash && \
18588 mkdir -p /cache/ccache && \
18689 mkdir /cache/depends && \
18790 mkdir /cache/sdk-sources && \
188- chown ${USER_ID}:${GROUP_ID} /src && \
189- chown ${USER_ID}:${GROUP_ID} -R /src && \
19091 chown ${USER_ID}:${GROUP_ID} /cache && \
19192 chown ${USER_ID}:${GROUP_ID} -R /cache
19293
193- WORKDIR /src/dash
194-
94+ # We're done, switch back to non-privileged user
19595USER dash
0 commit comments