Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 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 Jammy |
| 15 | # with some updated packages. |
| 16 | # |
| 17 | |
| 18 | FROM buildpack-deps:jammy-scm |
| 19 | LABEL MAINTAINER="Apache Thrift <dev@thrift.apache.org>" |
| 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 | # Dart |
| 36 | RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ |
| 37 | curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > \ |
| 38 | /etc/apt/sources.list.d/dart_stable.list |
| 39 | |
| 40 | # dotnet (netcore) |
| 41 | RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \ |
Thomas | c890ed4 | 2024-02-25 19:58:30 +0900 | [diff] [blame^] | 42 | wget -q -O /etc/apt/sources.list.d/microsoft-prod.list https://packages.microsoft.com/config/ubuntu/22.04/prod.list && \ |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 43 | chown root:root /etc/apt/trusted.gpg.d/microsoft.gpg && \ |
| 44 | chown root:root /etc/apt/sources.list.d/microsoft-prod.list |
| 45 | |
| 46 | # node.js |
| 47 | RUN curl -sL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ |
| 48 | echo "deb https://deb.nodesource.com/node_16.x focal main" | tee /etc/apt/sources.list.d/nodesource.list |
| 49 | |
| 50 | ### install general dependencies |
| 51 | RUN apt-get update -yq && \ |
| 52 | apt-get install -y --no-install-recommends \ |
| 53 | `# General dependencies` \ |
| 54 | bash-completion \ |
| 55 | bison \ |
| 56 | build-essential \ |
| 57 | clang \ |
| 58 | cmake \ |
| 59 | debhelper \ |
| 60 | flex \ |
| 61 | gdb \ |
| 62 | libasound2 \ |
| 63 | libatk-bridge2.0-0 \ |
| 64 | libgtk-3-0 \ |
| 65 | llvm \ |
| 66 | ninja-build \ |
| 67 | pkg-config \ |
| 68 | unzip \ |
| 69 | valgrind \ |
| 70 | vim |
| 71 | ENV PATH /usr/lib/llvm-6.0/bin:$PATH |
| 72 | |
| 73 | # lib/as3 (ActionScript) |
| 74 | RUN mkdir -p /usr/local/adobe/flex/4.6 && \ |
| 75 | cd /usr/local/adobe/flex/4.6 && \ |
| 76 | wget -q "http://download.macromedia.com/pub/flex/sdk/flex_sdk_4.6.zip" && \ |
| 77 | unzip flex_sdk_4.6.zip |
| 78 | ENV FLEX_HOME /usr/local/adobe/flex/4.6 |
| 79 | |
| 80 | # TODO: "apt-get install" without "apt-get update" in the same "RUN" step can cause cache issues if modified later. |
| 81 | # See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run |
| 82 | RUN apt-get install -y --no-install-recommends \ |
| 83 | `# C++ dependencies` \ |
| 84 | libboost-all-dev \ |
| 85 | libevent-dev \ |
| 86 | libssl-dev \ |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 87 | qtbase5-dev \ |
| 88 | qtbase5-dev-tools |
| 89 | |
| 90 | ENV SBCL_VERSION 1.5.3 |
| 91 | RUN \ |
| 92 | `# Common Lisp (sbcl) dependencies` \ |
| 93 | curl --version && \ |
| 94 | 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# && \ |
| 95 | tar xjf sbcl-${SBCL_VERSION}-x86-64-linux-binary.tar.bz2 && \ |
| 96 | cd sbcl-${SBCL_VERSION}-x86-64-linux && \ |
| 97 | ./install.sh && \ |
| 98 | sbcl --version && \ |
| 99 | cd .. && \ |
| 100 | rm -rf sbcl* |
| 101 | |
| 102 | ENV D_VERSION 2.087.0 |
| 103 | ENV DMD_DEB dmd_2.087.0-0_amd64.deb |
| 104 | RUN \ |
| 105 | `# D dependencies` \ |
| 106 | wget -q http://downloads.dlang.org/releases/2.x/${D_VERSION}/${DMD_DEB} && \ |
| 107 | dpkg --install ${DMD_DEB} && \ |
| 108 | rm -f ${DMD_DEB} && \ |
| 109 | mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \ |
| 110 | git clone -b 'v2.0.2+2.0.16' https://github.com/D-Programming-Deimos/libevent.git deimos-libevent-2.0 && \ |
| 111 | mv deimos-libevent-2.0/deimos/* /usr/include/dmd/druntime/import/deimos/ && \ |
| 112 | mv deimos-libevent-2.0/C/* /usr/include/dmd/druntime/import/C/ && \ |
| 113 | rm -rf deimos-libevent-2.0 && \ |
| 114 | git clone -b 'v2.0.0+1.1.0h' https://github.com/D-Programming-Deimos/openssl.git deimos-openssl-1.1.0h && \ |
| 115 | mv deimos-openssl-1.1.0h/deimos/* /usr/include/dmd/druntime/import/deimos/ && \ |
| 116 | mv deimos-openssl-1.1.0h/C/* /usr/include/dmd/druntime/import/C/ && \ |
| 117 | rm -rf deimos-openssl-1.1.0h |
| 118 | |
| 119 | ENV DART_VERSION 2.7.2-1 |
| 120 | RUN apt-get install -y --no-install-recommends \ |
| 121 | `# Dart dependencies` \ |
| 122 | dart=$DART_VERSION |
| 123 | ENV PATH /usr/lib/dart/bin:$PATH |
| 124 | |
| 125 | RUN apt-get install -y --no-install-recommends \ |
| 126 | `# dotnet core dependencies` \ |
Jens Geyer | 4115e95 | 2023-11-21 23:00:01 +0100 | [diff] [blame] | 127 | dotnet-sdk-8.0 \ |
| 128 | dotnet-runtime-8.0 \ |
| 129 | aspnetcore-runtime-8.0 \ |
| 130 | dotnet-apphost-pack-8.0 |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 131 | |
| 132 | # Erlang dependencies |
Thomas | c890ed4 | 2024-02-25 19:58:30 +0900 | [diff] [blame^] | 133 | ARG ERLANG_OTP_VERSION=25.3.2.9 |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 134 | ARG ERLANG_REBAR_VERSION=3.18.0 |
| 135 | RUN apt-get update && apt-get install -y --no-install-recommends libncurses5-dev && \ |
| 136 | curl -ssLo /usr/local/bin/kerl https://raw.githubusercontent.com/kerl/kerl/master/kerl && chmod +x /usr/local/bin/kerl && \ |
| 137 | kerl build $ERLANG_OTP_VERSION && kerl install $ERLANG_OTP_VERSION /usr/local/lib/otp/ && . /usr/local/lib/otp/activate && \ |
| 138 | curl -ssLo /usr/local/bin/rebar3 https://github.com/erlang/rebar3/releases/download/${ERLANG_REBAR_VERSION}/rebar3 && chmod +x /usr/local/bin/rebar3 && \ |
| 139 | rebar3 --version |
| 140 | ENV PATH /usr/local/lib/otp/bin:$PATH |
| 141 | |
| 142 | RUN apt-get install -y --no-install-recommends \ |
| 143 | `# GlibC dependencies` \ |
| 144 | libglib2.0-dev |
| 145 | |
| 146 | # golang |
Yuxuan 'fishy' Wang | b94eac7 | 2023-02-02 09:41:31 -0800 | [diff] [blame] | 147 | ENV GOLANG_VERSION 1.20 |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 148 | ENV GOLANG_DOWNLOAD_URL https://go.dev/dl/go$GOLANG_VERSION.linux-amd64.tar.gz |
Yuxuan 'fishy' Wang | b94eac7 | 2023-02-02 09:41:31 -0800 | [diff] [blame] | 149 | ENV GOLANG_DOWNLOAD_SHA256 5a9ebcc65c1cce56e0d2dc616aff4c4cedcfbda8cc6f0288cc08cda3b18dcbf1 |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 150 | RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz && \ |
| 151 | echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - && \ |
| 152 | tar -C /usr/local -xzf golang.tar.gz && \ |
| 153 | ln -s /usr/local/go/bin/go /usr/local/bin && \ |
| 154 | rm golang.tar.gz |
| 155 | |
| 156 | RUN apt-get install -y --no-install-recommends \ |
| 157 | `# Haxe dependencies` \ |
| 158 | haxe \ |
| 159 | neko \ |
| 160 | neko-dev && \ |
| 161 | haxelib setup --always /usr/share/haxe/lib && \ |
| 162 | haxelib install --always hxcpp 2>&1 > /dev/null |
| 163 | |
Jiayu Liu | d40dd72 | 2023-10-19 08:37:49 +0800 | [diff] [blame] | 164 | ENV GRADLE_VERSION="8.4" |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 165 | RUN apt-get install -y --no-install-recommends \ |
| 166 | `# Java dependencies` \ |
| 167 | ant \ |
| 168 | ant-optional \ |
| 169 | maven \ |
Thomas | c890ed4 | 2024-02-25 19:58:30 +0900 | [diff] [blame^] | 170 | openjdk-17-jdk-headless && \ |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 171 | `# Gradle` \ |
| 172 | wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip && \ |
Jiayu Liu | d40dd72 | 2023-10-19 08:37:49 +0800 | [diff] [blame] | 173 | (echo "3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -) && \ |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 174 | unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip && \ |
| 175 | mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle && \ |
| 176 | ln -s /usr/local/gradle/bin/gradle /usr/local/bin |
| 177 | |
| 178 | RUN apt-get install -y --no-install-recommends \ |
| 179 | `# Lua dependencies` \ |
| 180 | lua5.2 \ |
| 181 | lua5.2-dev |
| 182 | # https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212 |
| 183 | # lua5.3 does not install alternatives! |
| 184 | # need to update our luasocket code, lua doesn't have luaL_openlib any more |
| 185 | |
| 186 | RUN apt-get install -y --no-install-recommends \ |
| 187 | `# Node.js dependencies` \ |
| 188 | nodejs |
| 189 | |
| 190 | # Test dependencies for running puppeteer |
| 191 | RUN apt-get install -y --no-install-recommends \ |
| 192 | `# JS dependencies` \ |
| 193 | libxss1 \ |
| 194 | libxtst6 |
| 195 | |
| 196 | RUN apt-get install -y --no-install-recommends \ |
| 197 | `# OCaml dependencies` \ |
| 198 | ocaml \ |
| 199 | opam && \ |
| 200 | `# disable sandboxing see https://github.com/ocaml/opam/issues/4327` \ |
| 201 | opam init --yes --disable-sandboxing && \ |
| 202 | opam install --yes oasis |
| 203 | |
| 204 | RUN apt-get install -y --no-install-recommends \ |
| 205 | `# Perl dependencies` \ |
| 206 | libbit-vector-perl \ |
| 207 | libclass-accessor-class-perl \ |
| 208 | libcrypt-ssleay-perl \ |
| 209 | libio-socket-ssl-perl \ |
| 210 | libnet-ssleay-perl \ |
| 211 | libtest-exception-perl |
| 212 | |
| 213 | RUN apt-get install -y --no-install-recommends \ |
| 214 | `# Php dependencies` \ |
| 215 | php \ |
| 216 | php-cli \ |
| 217 | php-dev \ |
| 218 | php-json \ |
| 219 | php-pear \ |
| 220 | re2c \ |
| 221 | composer |
| 222 | |
| 223 | RUN apt-get install -y --no-install-recommends \ |
| 224 | `# Python3 dependencies` \ |
| 225 | python3-all \ |
| 226 | python3-all-dbg \ |
| 227 | python3-all-dev \ |
| 228 | python3-pip \ |
| 229 | python3-setuptools \ |
| 230 | python3-six \ |
| 231 | python3-tornado \ |
| 232 | python3-twisted \ |
| 233 | python3-wheel \ |
| 234 | python3-zope.interface |
| 235 | |
| 236 | RUN apt-get install -y --no-install-recommends \ |
| 237 | `# Ruby dependencies` \ |
| 238 | ruby \ |
| 239 | ruby-dev \ |
| 240 | ruby-bundler |
| 241 | |
| 242 | # Rust dependencies |
Jiayu Liu | fbfa52c | 2023-11-07 13:47:24 +0800 | [diff] [blame] | 243 | RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.65.0 -y |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 244 | ENV PATH /root/.cargo/bin:$PATH |
| 245 | |
| 246 | # Swift on Linux for cross tests |
| 247 | RUN apt-get install -yq \ |
| 248 | libedit-dev \ |
| 249 | libz3-dev \ |
| 250 | libpython2-dev \ |
| 251 | libxml2-dev && \ |
| 252 | cd / && \ |
| 253 | wget --quiet https://download.swift.org/swift-5.7-release/ubuntu2204/swift-5.7-RELEASE/swift-5.7-RELEASE-ubuntu22.04.tar.gz && \ |
Kino Roy | c495448 | 2022-11-19 22:52:04 -0800 | [diff] [blame] | 254 | tar xf swift-5.7-RELEASE-ubuntu22.04.tar.gz && \ |
| 255 | mv swift-5.7-RELEASE-ubuntu22.04 /usr/share/swift && \ |
| 256 | rm swift-5.7-RELEASE-ubuntu22.04.tar.gz |
| 257 | |
| 258 | ENV PATH /usr/share/swift/usr/bin:$PATH |
| 259 | RUN swift --version |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 260 | |
| 261 | # Locale(s) for cpp unit tests |
| 262 | RUN apt-get install -y --no-install-recommends \ |
| 263 | `# Locale dependencies` \ |
| 264 | locales && \ |
| 265 | locale-gen en_US.UTF-8 && \ |
| 266 | locale-gen de_DE.UTF-8 && \ |
| 267 | update-locale |
| 268 | |
| 269 | RUN apt-get install -y --no-install-recommends \ |
| 270 | `# Static Code Analysis dependencies` \ |
| 271 | cppcheck \ |
| 272 | sloccount && \ |
| 273 | pip install flake8 |
| 274 | |
| 275 | # NOTE: this does not reduce the image size but adds an additional layer. |
| 276 | # # Clean up |
| 277 | # RUN rm -rf /var/cache/apt/* && \ |
| 278 | # rm -rf /var/lib/apt/lists/* && \ |
| 279 | # rm -rf /tmp/* && \ |
| 280 | # rm -rf /var/tmp/* |
| 281 | |
Thomas | c890ed4 | 2024-02-25 19:58:30 +0900 | [diff] [blame^] | 282 | ARG user=build |
| 283 | ARG group=build |
| 284 | ARG uid=1000 |
| 285 | ARG gid=1000 |
| 286 | |
| 287 | RUN apt-get install -y --no-install-recommends sudo && \ |
| 288 | echo "Running with: UID: ${uid}, User: ${user}, GID: ${gid}, Group: ${group}" && \ |
| 289 | if [ -z `cat /etc/group | grep "${group}:"` ]; then addgroup --gid ${gid} ${group}; fi && \ |
| 290 | adduser --uid ${uid} --gid ${gid} --shell /bin/bash ${user} --disabled-password -q --gecos "" && \ |
| 291 | echo "${user} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers |
| 292 | |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 293 | ENV THRIFT_ROOT /thrift |
Thomas | c890ed4 | 2024-02-25 19:58:30 +0900 | [diff] [blame^] | 294 | RUN mkdir -p $THRIFT_ROOT/src && \ |
| 295 | chown -R ${uid}:${uid} $THRIFT_ROOT/ |
Jiayu Liu | 564b287 | 2022-10-12 11:42:38 +0800 | [diff] [blame] | 296 | COPY Dockerfile $THRIFT_ROOT/ |
| 297 | WORKDIR $THRIFT_ROOT/src |
Thomas | c890ed4 | 2024-02-25 19:58:30 +0900 | [diff] [blame^] | 298 | |
| 299 | USER ${user} |