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
24
2
25
- # Set Path
26
- ENV PATH="/usr/local/bin:${PATH}"
3
+ FROM ./ci-slim.Dockerfile
27
4
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
34
8
35
9
# Install common packages
36
10
RUN set -ex; \
@@ -41,28 +15,18 @@ RUN set -ex; \
41
15
autoconf \
42
16
bear \
43
17
bison \
44
- build-essential \
45
18
bsdmainutils \
46
- curl \
47
19
ccache \
48
20
cmake \
49
- g++ \
50
21
gettext \
51
- git \
52
22
libtool \
53
23
unzip \
54
24
m4 \
55
25
pkg-config \
56
- zlib1g-dev \
57
26
&& rm -rf /var/lib/apt/lists/*
58
27
59
- # Install Clang+LLVM and set it as default
60
- ARG LLVM_VERSION=18
28
+ # Install Clang + LLVM and set it as default
61
29
RUN 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; \
66
30
apt-get update && apt-get install ${APT_ARGS} \
67
31
"clang-${LLVM_VERSION}" \
68
32
"clangd-${LLVM_VERSION}" \
@@ -73,8 +37,7 @@ RUN set -ex; \
73
37
"libclang-${LLVM_VERSION}-dev" \
74
38
"libclang-rt-${LLVM_VERSION}-dev" \
75
39
"lld-${LLVM_VERSION}" \
76
- "lldb-${LLVM_VERSION}" \
77
- "llvm-${LLVM_VERSION}-dev" ; \
40
+ "lldb-${LLVM_VERSION}" ; \
78
41
rm -rf /var/lib/apt/lists/*; \
79
42
echo "Setting defaults..." ; \
80
43
lldbUpdAltArgs="update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${LLVM_VERSION} 100" ; \
@@ -88,48 +51,6 @@ RUN set -ex; \
88
51
# LD_LIBRARY_PATH is empty by default, this is the first entry
89
52
ENV LD_LIBRARY_PATH="/usr/lib/llvm-${LLVM_VERSION}/lib"
90
53
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
-
133
54
RUN set -ex; \
134
55
git clone --depth=1 "https://github.com/include-what-you-use/include-what-you-use" -b "clang_${LLVM_VERSION}" /opt/iwyu; \
135
56
cd /opt/iwyu; \
@@ -138,22 +59,6 @@ RUN set -ex; \
138
59
make install -j "$(( $(nproc) - 1 ))" ; \
139
60
cd /opt && rm -rf /opt/iwyu;
140
61
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
-
157
62
# Packages needed for all target builds
158
63
RUN apt-get update && apt-get install $APT_ARGS \
159
64
bc \
@@ -171,7 +76,6 @@ RUN apt-get update && apt-get install $APT_ARGS \
171
76
wine-stable \
172
77
wine64 \
173
78
zip \
174
- zstd \
175
79
&& rm -rf /var/lib/apt/lists/*
176
80
177
81
# Make sure std::thread and friends is available
@@ -181,15 +85,11 @@ RUN \
181
85
exit 0
182
86
183
87
RUN \
184
- mkdir -p /src/dash && \
185
88
mkdir -p /cache/ccache && \
186
89
mkdir /cache/depends && \
187
90
mkdir /cache/sdk-sources && \
188
- chown ${USER_ID}:${GROUP_ID} /src && \
189
- chown ${USER_ID}:${GROUP_ID} -R /src && \
190
91
chown ${USER_ID}:${GROUP_ID} /cache && \
191
92
chown ${USER_ID}:${GROUP_ID} -R /cache
192
93
193
- WORKDIR /src/dash
194
-
94
+ # We're done, switch back to non-privileged user
195
95
USER dash
0 commit comments