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