| 1 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 |
# you may not use this file except in compliance with the License. |
| 3 |
# You may obtain a copy of the License at |
| 4 |
# |
| 5 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 |
# |
| 7 |
# Unless required by applicable law or agreed to in writing, software |
| 8 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 9 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 |
# See the License for the specific language governing permissions and |
| 11 |
# limitations under the License. |
| 12 |
|
| 13 |
# |
| 14 |
# Apache Thrift Docker build environment for Ubuntu Noble |
| 15 |
# with some updated packages. |
| 16 |
# |
| 17 |
|
| 18 |
FROM buildpack-deps:noble-scm |
| 19 |
LABEL MAINTAINER="Apache Thrift <[email protected]>" |
| 20 |
ENV DEBIAN_FRONTEND=noninteractive |
| 21 |
|
| 22 |
### Add apt repos |
| 23 |
|
| 24 |
RUN apt-get update -yq && \ |
| 25 |
apt-get dist-upgrade -y && \ |
| 26 |
apt-get install -y --no-install-recommends --fix-missing \ |
| 27 |
apt \ |
| 28 |
apt-transport-https \ |
| 29 |
apt-utils \ |
| 30 |
curl \ |
| 31 |
dirmngr \ |
| 32 |
software-properties-common \ |
| 33 |
wget |
| 34 |
|
| 35 |
# Create a user |
| 36 |
ARG user=build |
| 37 |
ARG group=build |
| 38 |
ARG uid=1001 |
| 39 |
ARG gid=1001 |
| 40 |
|
| 41 |
RUN apt-get install -y --no-install-recommends sudo && \ |
| 42 |
echo "Running with: UID: ${uid}, User: ${user}, GID: ${gid}, Group: ${group}" && \ |
| 43 |
if [ -z `cat /etc/group | grep "${group}:"` ] && [ -z `cat /etc/group | grep ":${gid}:"` ]; then addgroup --gid ${gid} ${group}; fi && \ |
| 44 |
if [ -z `cat /etc/passwd | grep "${user}:"` ] && [ -z `cat /etc/passwd | grep ":${uid}:"` ]; then adduser --uid ${uid} --gid ${gid} --shell /bin/bash ${user} --disabled-password -q --gecos ""; fi && \ |
| 45 |
echo "${user} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ |
| 46 |
mkdir -p /home/${user} && \ |
| 47 |
chown -R ${user}:${group} /home/${user} |
| 48 |
|
| 49 |
# Dart |
| 50 |
RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ |
| 51 |
curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > \ |
| 52 |
/etc/apt/sources.list.d/dart_stable.list |
| 53 |
|
| 54 |
# node.js |
| 55 |
RUN mkdir -p /etc/apt/keyrings && \ |
| 56 |
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ |
| 57 |
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list |
| 58 |
|
| 59 |
### install general dependencies |
| 60 |
RUN apt-get update -yq && \ |
| 61 |
apt-get install -y --no-install-recommends \ |
| 62 |
`# General dependencies` \ |
| 63 |
bash-completion \ |
| 64 |
bison \ |
| 65 |
build-essential \ |
| 66 |
clang \ |
| 67 |
cmake \ |
| 68 |
debhelper \ |
| 69 |
flex \ |
| 70 |
gdb \ |
| 71 |
libatk-bridge2.0-0 \ |
| 72 |
libgtk-3-0 \ |
| 73 |
llvm \ |
| 74 |
ninja-build \ |
| 75 |
pkg-config \ |
| 76 |
unzip \ |
| 77 |
valgrind \ |
| 78 |
vim |
| 79 |
ENV PATH=/usr/lib/llvm-6.0/bin:$PATH |
| 80 |
|
| 81 |
# lib/as3 (ActionScript) |
| 82 |
RUN mkdir -p /usr/local/adobe/flex/4.6 && \ |
| 83 |
cd /usr/local/adobe/flex/4.6 && \ |
| 84 |
wget -q "http://download.macromedia.com/pub/flex/sdk/flex_sdk_4.6.zip" && \ |
| 85 |
unzip flex_sdk_4.6.zip |
| 86 |
ENV FLEX_HOME=/usr/local/adobe/flex/4.6 |
| 87 |
|
| 88 |
# TODO: "apt-get install" without "apt-get update" in the same "RUN" step can cause cache issues if modified later. |
| 89 |
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run |
| 90 |
RUN apt-get install -y --no-install-recommends \ |
| 91 |
`# C++ dependencies` \ |
| 92 |
libboost-all-dev \ |
| 93 |
libevent-dev \ |
| 94 |
libssl-dev \ |
| 95 |
qtbase5-dev \ |
| 96 |
qtbase5-dev-tools |
| 97 |
|
| 98 |
ENV SBCL_VERSION=1.5.3 |
| 99 |
RUN \ |
| 100 |
`# Common Lisp (sbcl) dependencies` \ |
| 101 |
curl --version && \ |
| 102 |
curl -o sbcl-${SBCL_VERSION}-x86-64-linux-binary.tar.bz2 -J -L https://sourceforge.net/projects/sbcl/files/sbcl/${SBCL_VERSION}/sbcl-${SBCL_VERSION}-x86-64-linux-binary.tar.bz2/download?use_mirror=managedway# && \ |
| 103 |
tar xjf sbcl-${SBCL_VERSION}-x86-64-linux-binary.tar.bz2 && \ |
| 104 |
cd sbcl-${SBCL_VERSION}-x86-64-linux && \ |
| 105 |
./install.sh && \ |
| 106 |
sbcl --version && \ |
| 107 |
cd .. && \ |
| 108 |
rm -rf sbcl* |
| 109 |
|
| 110 |
ENV D_VERSION=2.087.0 |
| 111 |
ENV DMD_DEB=dmd_2.087.0-0_amd64.deb |
| 112 |
RUN \ |
| 113 |
`# D dependencies` \ |
| 114 |
wget -q http://downloads.dlang.org/releases/2.x/${D_VERSION}/${DMD_DEB} && \ |
| 115 |
dpkg --install ${DMD_DEB} && \ |
| 116 |
rm -f ${DMD_DEB} && \ |
| 117 |
mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \ |
| 118 |
git clone -b 'v2.0.2+2.0.16' https://github.com/D-Programming-Deimos/libevent.git deimos-libevent-2.0 && \ |
| 119 |
mv deimos-libevent-2.0/deimos/* /usr/include/dmd/druntime/import/deimos/ && \ |
| 120 |
mv deimos-libevent-2.0/C/* /usr/include/dmd/druntime/import/C/ && \ |
| 121 |
rm -rf deimos-libevent-2.0 && \ |
| 122 |
git clone -b 'v2.0.0+1.1.0h' https://github.com/D-Programming-Deimos/openssl.git deimos-openssl-1.1.0h && \ |
| 123 |
mv deimos-openssl-1.1.0h/deimos/* /usr/include/dmd/druntime/import/deimos/ && \ |
| 124 |
mv deimos-openssl-1.1.0h/C/* /usr/include/dmd/druntime/import/C/ && \ |
| 125 |
rm -rf deimos-openssl-1.1.0h |
| 126 |
|
| 127 |
ENV DART_VERSION=2.7.2-1 |
| 128 |
RUN apt-get install -y --no-install-recommends \ |
| 129 |
`# Dart dependencies` \ |
| 130 |
dart=$DART_VERSION |
| 131 |
ENV PATH=/usr/lib/dart/bin:$PATH |
| 132 |
|
| 133 |
RUN add-apt-repository ppa:dotnet/backports |
| 134 |
RUN apt-get install -y --no-install-recommends \ |
| 135 |
`# dotnet core dependencies` \ |
| 136 |
dotnet-sdk-10.0 \ |
| 137 |
dotnet-runtime-10.0 \ |
| 138 |
aspnetcore-runtime-10.0 \ |
| 139 |
dotnet-apphost-pack-10.0 |
| 140 |
|
| 141 |
# Erlang dependencies |
| 142 |
ARG ERLANG_OTP_VERSION=25.3.2.9 |
| 143 |
ARG ERLANG_REBAR_VERSION=3.18.0 |
| 144 |
RUN apt-get update && apt-get install -y --no-install-recommends libncurses5-dev && \ |
| 145 |
curl -ssLo /usr/local/bin/kerl https://raw.githubusercontent.com/kerl/kerl/master/kerl && chmod +x /usr/local/bin/kerl && \ |
| 146 |
kerl build $ERLANG_OTP_VERSION && kerl install $ERLANG_OTP_VERSION /usr/local/lib/otp/ && . /usr/local/lib/otp/activate && \ |
| 147 |
curl -ssLo /usr/local/bin/rebar3 https://github.com/erlang/rebar3/releases/download/${ERLANG_REBAR_VERSION}/rebar3 && chmod +x /usr/local/bin/rebar3 && \ |
| 148 |
rebar3 --version |
| 149 |
ENV PATH=/usr/local/lib/otp/bin:$PATH |
| 150 |
|
| 151 |
RUN apt-get install -y --no-install-recommends \ |
| 152 |
`# GlibC dependencies` \ |
| 153 |
libglib2.0-dev |
| 154 |
|
| 155 |
# golang |
| 156 |
ENV GOLANG_VERSION=1.24.3 |
| 157 |
ENV GOLANG_DOWNLOAD_URL=https://go.dev/dl/go$GOLANG_VERSION.linux-amd64.tar.gz |
| 158 |
ENV GOLANG_DOWNLOAD_SHA256=3333f6ea53afa971e9078895eaa4ac7204a8c6b5c68c10e6bc9a33e8e391bdd8 |
| 159 |
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz && \ |
| 160 |
echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - && \ |
| 161 |
tar -C /usr/local -xzf golang.tar.gz && \ |
| 162 |
ln -s /usr/local/go/bin/go /usr/local/bin && \ |
| 163 |
rm golang.tar.gz |
| 164 |
|
| 165 |
# HAXE |
| 166 |
ARG HAXE_VERSION=4.2.1 |
| 167 |
ARG NEKO_VERSION=2.3.0 |
| 168 |
RUN cd $HOME && \ |
| 169 |
`# Haxe dependencies` && \ |
| 170 |
wget https://github.com/HaxeFoundation/haxe/releases/download/${HAXE_VERSION}/haxe-${HAXE_VERSION}-linux64.tar.gz && \ |
| 171 |
tar xvf haxe-${HAXE_VERSION}-linux64.tar.gz && \ |
| 172 |
rm haxe-${HAXE_VERSION}-linux64.tar.gz && \ |
| 173 |
mv haxe_* /opt/haxe && \ |
| 174 |
wget https://github.com/HaxeFoundation/neko/releases/download/v`echo ${NEKO_VERSION} | sed "s/\./-/g"`/neko-${NEKO_VERSION}-linux64.tar.gz && \ |
| 175 |
tar xvf neko-${NEKO_VERSION}-linux64.tar.gz && \ |
| 176 |
rm neko-${NEKO_VERSION}-linux64.tar.gz && \ |
| 177 |
mv neko-* /opt/neko |
| 178 |
ENV PATH=/opt/haxe:/opt/neko:$PATH |
| 179 |
RUN echo "/opt/neko" > /etc/ld.so.conf.d/neko.conf && \ |
| 180 |
ldconfig |
| 181 |
USER ${user} |
| 182 |
RUN mkdir -p $HOME/haxe/lib && \ |
| 183 |
haxelib setup --always $HOME/haxe/lib && \ |
| 184 |
haxelib install --always hxcpp 2>&1 > /dev/null && \ |
| 185 |
haxelib install --always uuid 2>&1 > /dev/null |
| 186 |
USER root |
| 187 |
|
| 188 |
ENV GRADLE_VERSION="8.4" |
| 189 |
RUN apt-get install -y --no-install-recommends \ |
| 190 |
`# Java dependencies` \ |
| 191 |
ant \ |
| 192 |
ant-optional \ |
| 193 |
maven \ |
| 194 |
openjdk-17-jdk-headless && \ |
| 195 |
`# Gradle` \ |
| 196 |
wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip && \ |
| 197 |
(echo "3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -) && \ |
| 198 |
unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip && \ |
| 199 |
mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle && \ |
| 200 |
ln -s /usr/local/gradle/bin/gradle /usr/local/bin |
| 201 |
|
| 202 |
RUN apt-get install -y --no-install-recommends \ |
| 203 |
`# Lua dependencies` \ |
| 204 |
lua5.4 \ |
| 205 |
liblua5.4-dev |
| 206 |
# https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212 |
| 207 |
# lua5.3 does not install alternatives! |
| 208 |
# need to update our luasocket code, lua doesn't have luaL_openlib any more |
| 209 |
|
| 210 |
RUN apt-get install -y --no-install-recommends \ |
| 211 |
`# Node.js dependencies` \ |
| 212 |
nodejs |
| 213 |
|
| 214 |
# Test dependencies for running puppeteer |
| 215 |
RUN apt-get install -y --no-install-recommends \ |
| 216 |
`# JS dependencies` \ |
| 217 |
libxss1 \ |
| 218 |
libxtst6 |
| 219 |
|
| 220 |
RUN apt-get install -y --no-install-recommends \ |
| 221 |
`# OCaml dependencies` \ |
| 222 |
ocaml \ |
| 223 |
opam && \ |
| 224 |
`# disable sandboxing see https://github.com/ocaml/opam/issues/4327` \ |
| 225 |
opam init --yes --disable-sandboxing && \ |
| 226 |
opam install --yes oasis |
| 227 |
|
| 228 |
RUN apt-get install -y --no-install-recommends \ |
| 229 |
`# Perl dependencies` \ |
| 230 |
libbit-vector-perl \ |
| 231 |
libclass-accessor-class-perl \ |
| 232 |
libcrypt-ssleay-perl \ |
| 233 |
libio-socket-ssl-perl \ |
| 234 |
libnet-ssleay-perl \ |
| 235 |
libtest-exception-perl |
| 236 |
|
| 237 |
RUN apt-get install -y --no-install-recommends \ |
| 238 |
`# Php dependencies` \ |
| 239 |
php8.3 \ |
| 240 |
php8.3-cli \ |
| 241 |
php8.3-dev \ |
| 242 |
php8.3-mbstring \ |
| 243 |
php8.3-xml \ |
| 244 |
php8.3-curl \ |
| 245 |
php8.3-xdebug \ |
| 246 |
php-pear \ |
| 247 |
re2c \ |
| 248 |
composer |
| 249 |
|
| 250 |
RUN apt-get install -y --no-install-recommends \ |
| 251 |
`# Python3 dependencies` \ |
| 252 |
python3-all \ |
| 253 |
python3-all-dbg \ |
| 254 |
python3-all-dev \ |
| 255 |
python3-pip \ |
| 256 |
python3-setuptools \ |
| 257 |
python3-wheel |
| 258 |
|
| 259 |
RUN python3 -m pip install --no-cache-dir --upgrade --break-system-packages \ |
| 260 |
"tornado>=6.3.0" \ |
| 261 |
"twisted>=24.3.0" \ |
| 262 |
"zope.interface>=6.1" |
| 263 |
|
| 264 |
RUN apt-get install -y --no-install-recommends \ |
| 265 |
`# Ruby dependencies` \ |
| 266 |
ruby \ |
| 267 |
ruby-dev \ |
| 268 |
ruby-bundler |
| 269 |
|
| 270 |
USER ${user} |
| 271 |
RUN `# Rust dependencies` \ |
| 272 |
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.83.0 -y |
| 273 |
ENV PATH=/home/${user}/.cargo/bin:$PATH |
| 274 |
USER root |
| 275 |
|
| 276 |
# Swift on Linux for cross tests |
| 277 |
RUN apt-get install -yq \ |
| 278 |
libedit-dev \ |
| 279 |
libz3-dev \ |
| 280 |
python3-flake8 \ |
| 281 |
libxml2-dev && \ |
| 282 |
cd / && \ |
| 283 |
wget --quiet https://download.swift.org/swift-6.1-release/ubuntu2404/swift-6.1-RELEASE/swift-6.1-RELEASE-ubuntu24.04.tar.gz && \ |
| 284 |
tar xf swift-6.1-RELEASE-ubuntu24.04.tar.gz && \ |
| 285 |
mv swift-6.1-RELEASE-ubuntu24.04 /usr/share/swift && \ |
| 286 |
rm swift-6.1-RELEASE-ubuntu24.04.tar.gz |
| 287 |
|
| 288 |
ENV PATH=/usr/share/swift/usr/bin:$PATH |
| 289 |
RUN swift --version |
| 290 |
|
| 291 |
# Locale(s) for cpp unit tests |
| 292 |
RUN apt-get install -y --no-install-recommends \ |
| 293 |
`# Locale dependencies` \ |
| 294 |
locales && \ |
| 295 |
locale-gen en_US.UTF-8 && \ |
| 296 |
locale-gen de_DE.UTF-8 && \ |
| 297 |
update-locale |
| 298 |
|
| 299 |
RUN apt-get install -y --no-install-recommends \ |
| 300 |
`# Static Code Analysis dependencies` \ |
| 301 |
cppcheck \ |
| 302 |
sloccount |
| 303 |
|
| 304 |
#RUN pip install flake8 |
| 305 |
|
| 306 |
# NOTE: this does not reduce the image size but adds an additional layer. |
| 307 |
# # Clean up |
| 308 |
# RUN rm -rf /var/cache/apt/* && \ |
| 309 |
# rm -rf /var/lib/apt/lists/* && \ |
| 310 |
# rm -rf /tmp/* && \ |
| 311 |
# rm -rf /var/tmp/* |
| 312 |
|
| 313 |
ENV THRIFT_ROOT=/thrift |
| 314 |
RUN mkdir -p $THRIFT_ROOT/src && \ |
| 315 |
chown -R ${uid}:${uid} $THRIFT_ROOT/ |
| 316 |
COPY Dockerfile $THRIFT_ROOT/ |
| 317 |
WORKDIR $THRIFT_ROOT/src |
| 318 |
|
| 319 |
USER ${user} |