blob: 64d4804f776c5da11f7f95b89ccbfa4a25b80ecb [file] [log] [blame]
James E. King, IIIb66b66f2017-08-31 18:07:40 -07001# 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
James E. King, III0ad20bd2017-09-30 15:44:16 -070013#
James E. King, IIIb66b66f2017-08-31 18:07:40 -070014# Apache Thrift Docker build environment for Ubuntu Xenial
James E. King, III0ad20bd2017-09-30 15:44:16 -070015# Using all stock Ubuntu Xenial packaging except for:
James Lacey7054b312021-03-26 11:38:38 -070016# - d: does not come with Ubuntu so we're installing 2.087.0 for coverage
James E. King III93ff9b02019-06-21 17:50:34 -040017# - dart: does not come with Ubuntu so we're installing 2.0.0-1 for coverage
John Boiles57852792018-01-05 14:37:05 -080018# - dotnet: does not come with Ubuntu
James E. King III3b779822019-03-15 15:59:27 -040019# - go: Xenial comes with 1.6, but we need 1.10 or later
Mario Emmenlauer55680af2020-05-11 22:58:48 +020020# - nodejs: Xenial comes with 4.2.6 which exits LTS April 2018, so we're installing 10.x
James E. King IIIa02ae562018-03-12 15:27:23 -040021# - ocaml: causes stack overflow error, just started March 2018 not sure why
James E. King, III0ad20bd2017-09-30 15:44:16 -070022#
23
James E. King, IIIb66b66f2017-08-31 18:07:40 -070024FROM buildpack-deps:xenial-scm
25MAINTAINER Apache Thrift <dev@thrift.apache.org>
James E. King, IIIb66b66f2017-08-31 18:07:40 -070026ENV DEBIAN_FRONTEND noninteractive
27
James E. King, IIId7142b72017-09-01 13:00:36 -070028### Add apt repos
James E. King, IIIb66b66f2017-08-31 18:07:40 -070029
Robert Lu31d5b7b2018-01-05 13:44:38 +080030RUN apt-get update && \
Jiayu Liu8a321562022-09-06 08:57:19 +080031 apt-get dist-upgrade -y && \
32 apt-get install -y --no-install-recommends \
Robert Lu31d5b7b2018-01-05 13:44:38 +080033 apt \
34 apt-transport-https \
35 apt-utils \
36 curl \
James E. King IIIad238522018-01-13 19:52:31 -050037 software-properties-common \
James E. King III93ff9b02019-06-21 17:50:34 -040038 wget && \
James E. King, IIIb66b66f2017-08-31 18:07:40 -070039
Jiayu Liu8a321562022-09-06 08:57:19 +080040 # Dart
41 curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
42 curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > \
James E. King III93ff9b02019-06-21 17:50:34 -040043 /etc/apt/sources.list.d/dart_stable.list && \
James E. King, IIIb66b66f2017-08-31 18:07:40 -070044
Jiayu Liu8a321562022-09-06 08:57:19 +080045 # dotnet (core)
46 curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
47 echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > \
James E. King III93ff9b02019-06-21 17:50:34 -040048 /etc/apt/sources.list.d/dotnetdev.list && \
James E. King, IIId7142b72017-09-01 13:00:36 -070049
Jiayu Liu8a321562022-09-06 08:57:19 +080050 # node.js
51 curl -sL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
52 echo "deb https://deb.nodesource.com/node_10.x xenial main" | tee /etc/apt/sources.list.d/nodesource.list && \
Jano Svitok299b68e2020-03-09 23:07:30 +010053
Jiayu Liu8a321562022-09-06 08:57:19 +080054 # ruby 2.4
55 apt-add-repository ppa:brightbox/ruby-ng
Brian Forbisb5d6ea32018-08-25 23:39:29 -040056
James E. King, IIId7142b72017-09-01 13:00:36 -070057### install general dependencies
James E. King, III0ad20bd2017-09-30 15:44:16 -070058RUN apt-get update && apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +080059 `# General dependencies` \
James E. King, IIIf4543692017-09-01 05:23:29 -070060 bash-completion \
James E. King, IIIb66b66f2017-08-31 18:07:40 -070061 bison \
62 build-essential \
63 clang \
64 cmake \
65 debhelper \
66 flex \
James E. King, IIId7142b72017-09-01 13:00:36 -070067 gdb \
68 llvm \
James E. King, IIIb66b66f2017-08-31 18:07:40 -070069 ninja-build \
70 pkg-config \
James E. King, III7d211b82017-09-06 10:12:02 -070071 valgrind \
James E. King, IIIb66b66f2017-08-31 18:07:40 -070072 vim
James E. King, IIId7142b72017-09-01 13:00:36 -070073ENV PATH /usr/lib/llvm-3.8/bin:$PATH
James E. King, IIIb66b66f2017-08-31 18:07:40 -070074
James E. King, IIId7142b72017-09-01 13:00:36 -070075### languages
James E. King, IIIb66b66f2017-08-31 18:07:40 -070076
Aki Sukegawa7594da82022-03-07 00:28:26 -050077# TODO: "apt-get install" without "apt-get update" in the same "RUN" step can cause cache issues if modified later.
78# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
James E. King, IIIb66b66f2017-08-31 18:07:40 -070079RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +080080 `# C++ dependencies` \
James E. King, IIIb66b66f2017-08-31 18:07:40 -070081 libboost-dev \
82 libboost-filesystem-dev \
83 libboost-program-options-dev \
84 libboost-system-dev \
85 libboost-test-dev \
86 libboost-thread-dev \
87 libevent-dev \
88 libssl-dev \
89 qt5-default \
90 qtbase5-dev \
91 qtbase5-dev-tools
92
James Lacey7054b312021-03-26 11:38:38 -070093ENV D_VERSION 2.087.0
94ENV DMD_DEB dmd_2.087.0-0_amd64.deb
95RUN \
Jiayu Liu8a321562022-09-06 08:57:19 +080096 `# D dependencies` \
97 wget -q http://downloads.dlang.org/releases/2.x/${D_VERSION}/${DMD_DEB} && \
98 dpkg --install ${DMD_DEB} && \
99 rm -f ${DMD_DEB} && \
100 mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \
101 git clone -b 'v2.0.2+2.0.16' https://github.com/D-Programming-Deimos/libevent.git deimos-libevent-2.0 && \
102 mv deimos-libevent-2.0/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
103 mv deimos-libevent-2.0/C/* /usr/include/dmd/druntime/import/C/ && \
104 rm -rf deimos-libevent-2.0 && \
105 git clone -b 'v1.1.6+1.0.1g' https://github.com/D-Programming-Deimos/openssl.git deimos-openssl-1.0.1g && \
106 mv deimos-openssl-1.0.1g/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
107 mv deimos-openssl-1.0.1g/C/* /usr/include/dmd/druntime/import/C/ && \
108 rm -rf deimos-openssl-1.0.1g
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700109
aaronstgeorge-wf1ab156a2020-10-01 17:28:28 +0200110ENV DART_VERSION 2.7.2-1
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700111RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800112 `# Dart dependencies` \
James E. King, III0ad20bd2017-09-30 15:44:16 -0700113 dart=$DART_VERSION
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700114ENV PATH /usr/lib/dart/bin:$PATH
115
James E. King, IIIb6287362017-09-28 11:57:42 +0000116RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800117 `# dotnet core dependencies` \
Jens Geyer51fc54f2023-02-14 23:51:16 +0100118 dotnet-sdk-7.0 \
119 dotnet-runtime-7.0 \
120 aspnetcore-runtime-7.0 \
121 dotnet-apphost-pack-7.0
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700122
Aki Sukegawa7594da82022-03-07 00:28:26 -0500123# Erlang dependencies
124ARG ERLANG_OTP_VERSION=18.3.4.11
125ARG ERLANG_REBAR_VERSION=3.13.2
126RUN apt-get update && apt-get install -y --no-install-recommends automake libncurses5-dev && \
Jiayu Liu8a321562022-09-06 08:57:19 +0800127 curl https://raw.githubusercontent.com/kerl/kerl/master/kerl -o /usr/local/bin/kerl && chmod +x /usr/local/bin/kerl && \
128 kerl build $ERLANG_OTP_VERSION && kerl install $ERLANG_OTP_VERSION /usr/local/lib/otp/ && . /usr/local/lib/otp/activate && \
129 curl https://s3.amazonaws.com/rebar3/rebar3 -o /usr/local/bin/rebar3 && chmod +x /usr/local/bin/rebar3 && \
130 curl -ssLo /usr/local/bin/rebar3 https://github.com/erlang/rebar3/releases/download/${ERLANG_REBAR_VERSION}/rebar3 && chmod +x /usr/local/bin/rebar3 && \
131 rebar3 --version
Aki Sukegawa7594da82022-03-07 00:28:26 -0500132ENV PATH /usr/local/lib/otp/bin:$PATH
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700133
134RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800135 `# GlibC dependencies` \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700136 libglib2.0-dev
137
John Boiles57852792018-01-05 14:37:05 -0800138# golang
Yuxuan 'fishy' Wang3f9b7d02022-08-02 11:31:14 -0700139ENV GOLANG_VERSION 1.18.5
Yuxuan 'fishy' Wangbbc7c5f2022-01-10 11:44:23 -0800140ENV GOLANG_DOWNLOAD_URL https://go.dev/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
Yuxuan 'fishy' Wang3f9b7d02022-08-02 11:31:14 -0700141ENV GOLANG_DOWNLOAD_SHA256 9e5de37f9c49942c601b191ac5fba404b868bfc21d446d6960acc12283d6e5f2
John Boiles57852792018-01-05 14:37:05 -0800142RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz && \
143 echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - && \
144 tar -C /usr/local -xzf golang.tar.gz && \
145 ln -s /usr/local/go/bin/go /usr/local/bin && \
146 rm golang.tar.gz
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700147
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700148RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800149 `# Haxe dependencies` \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700150 haxe \
151 neko \
152 neko-dev \
James E. King IIIad238522018-01-13 19:52:31 -0500153 libneko0 && \
Jiayu Liu8a321562022-09-06 08:57:19 +0800154 haxelib setup --always /usr/share/haxe/lib && \
155 haxelib install --always hxcpp 3.4.64 2>&1 > /dev/null
James E. King, III81cdcd32017-09-09 17:54:10 +0000156# note: hxcpp 3.4.185 (latest) no longer ships static libraries, and caused a build failure
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700157
Jiayu Liube73a572023-04-14 11:02:43 +0800158ENV GRADLE_VERSION="8.0.2"
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700159RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800160 `# Java dependencies` \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700161 ant \
162 ant-optional \
163 openjdk-8-jdk \
Jiayu Liu5d220eb2022-04-19 04:18:58 +0200164 maven \
165 unzip && \
Jiayu Liu8a321562022-09-06 08:57:19 +0800166 `# Gradle` \
Jiayu Liu5d220eb2022-04-19 04:18:58 +0200167 wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip && \
Jiayu Liube73a572023-04-14 11:02:43 +0800168 (echo "ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -) && \
Jiayu Liu5d220eb2022-04-19 04:18:58 +0200169 unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip && \
170 mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle && \
171 ln -s /usr/local/gradle/bin/gradle /usr/local/bin
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700172
James E. King III93ff9b02019-06-21 17:50:34 -0400173# disabled: same as ubuntu-bionic jobs
174# RUN apt-get install -y --no-install-recommends \
175# `# Lua dependencies` \
176# lua5.2 \
177# lua5.2-dev
James E. King, IIId7142b72017-09-01 13:00:36 -0700178# https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212
179# lua5.3 does not install alternatives so stick with 5.2 here
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700180
181RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800182 `# Node.js dependencies` \
James E. King IIIa37feaf2018-03-06 15:11:01 -0500183 nodejs
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700184
Brian Forbisb5d6ea32018-08-25 23:39:29 -0400185# Test dependencies for running puppeteer
186RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800187 `# JS dependencies` \
Brian Forbisb5d6ea32018-08-25 23:39:29 -0400188 libxss1 \
Yuxuan 'fishy' Wang0f735582021-04-28 08:33:36 -0700189 libxtst6 \
Brian Forbisb5d6ea32018-08-25 23:39:29 -0400190 libatk-bridge2.0-0 \
191 libgtk-3-0
192
James E. King IIIa02ae562018-03-12 15:27:23 -0400193# THRIFT-4517: causes stack overflows; version too old; skip ocaml in xenial
194# RUN apt-get install -y --no-install-recommends \
195# `# OCaml dependencies` \
196# ocaml \
197# opam && \
198# opam init --yes && \
199# opam install --yes oasis
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700200
201RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800202 `# Perl dependencies` \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700203 libbit-vector-perl \
204 libclass-accessor-class-perl \
205 libcrypt-ssleay-perl \
206 libio-socket-ssl-perl \
Kengo Sekicb4c31a2019-12-26 14:34:57 +0900207 libnet-ssleay-perl \
208 libtest-exception-perl
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700209
210RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800211 `# Php dependencies` \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700212 php7.0 \
213 php7.0-cli \
214 php7.0-dev \
James E. King IIIe53d23c2019-02-10 11:13:23 -0500215 php-json \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700216 php-pear \
217 re2c \
Robert Lua15060a2017-12-28 15:29:39 +0800218 composer
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700219
220RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800221 `# Python dependencies` \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700222 python-all \
223 python-all-dbg \
224 python-all-dev \
225 python-backports.ssl-match-hostname \
226 python-ipaddress \
227 python-pip \
228 python-setuptools \
James E. King, IIId7142b72017-09-01 13:00:36 -0700229 python-six \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700230 python-tornado \
231 python-twisted \
James E. King, IIId7142b72017-09-01 13:00:36 -0700232 python-wheel \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700233 python-zope.interface \
234 python3-all \
235 python3-all-dbg \
236 python3-all-dev \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700237 python3-setuptools \
James E. King, IIId7142b72017-09-01 13:00:36 -0700238 python3-six \
239 python3-tornado \
240 python3-twisted \
241 python3-wheel \
242 python3-zope.interface && \
Jiayu Liu8a321562022-09-06 08:57:19 +0800243 pip install --upgrade backports.ssl_match_hostname
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700244
245RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800246 `# Ruby dependencies` \
Jano Svitok299b68e2020-03-09 23:07:30 +0100247 ruby2.4 \
248 ruby2.4-dev \
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700249 ruby-bundler
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700250
Danny Browning181d9002019-04-15 09:50:24 -0600251# Rust dependencies
Tdxdxoz85d82bf2022-07-17 14:14:12 +0200252RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.61.0 -y
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700253
ubuntu323f0322021-05-31 19:08:05 +0530254# Locale(s) for cpp unit tests
255RUN apt-get install -y --no-install-recommends \
Jiayu Liu8a321562022-09-06 08:57:19 +0800256 `# Locale dependencies` \
ubuntu323f0322021-05-31 19:08:05 +0530257 locales && \
Jiayu Liu8a321562022-09-06 08:57:19 +0800258 locale-gen en_US.UTF-8 && \
259 locale-gen de_DE.UTF-8 && \
260 update-locale
ubuntu323f0322021-05-31 19:08:05 +0530261
Aki Sukegawa7594da82022-03-07 00:28:26 -0500262# NOTE: this does not reduce the image size but adds an additional layer.
263# # Clean up
264# RUN rm -rf /var/cache/apt/* && \
265# rm -rf /var/lib/apt/lists/* && \
266# rm -rf /tmp/* && \
267# rm -rf /var/tmp/*
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700268
James E. King, IIIb6287362017-09-28 11:57:42 +0000269ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
James E. King, IIIb66b66f2017-08-31 18:07:40 -0700270ENV THRIFT_ROOT /thrift
271RUN mkdir -p $THRIFT_ROOT/src
272COPY Dockerfile $THRIFT_ROOT/
273WORKDIR $THRIFT_ROOT/src