blob: a10fea6500a4f8162daddd993ce006f5ffe141f5 [file] [log] [blame]
Jiayu Liu564b2872022-10-12 11:42:38 +08001# 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
18FROM buildpack-deps:jammy-scm
19LABEL MAINTAINER="Apache Thrift <dev@thrift.apache.org>"
20ENV DEBIAN_FRONTEND=noninteractive
21
22### Add apt repos
23
24RUN 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
36RUN 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)
41RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
42 wget -q -O /etc/apt/sources.list.d/microsoft-prod.list https://packages.microsoft.com/config/ubuntu/18.04/prod.list && \
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
47RUN 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
51RUN 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
71ENV PATH /usr/lib/llvm-6.0/bin:$PATH
72
73# lib/as3 (ActionScript)
74RUN 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
78ENV 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
82RUN apt-get install -y --no-install-recommends \
83 `# C++ dependencies` \
84 libboost-all-dev \
85 libevent-dev \
86 libssl-dev \
87 qt5-default \
88 qtbase5-dev \
89 qtbase5-dev-tools
90
91ENV SBCL_VERSION 1.5.3
92RUN \
93 `# Common Lisp (sbcl) dependencies` \
94 curl --version && \
95 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# && \
96 tar xjf sbcl-${SBCL_VERSION}-x86-64-linux-binary.tar.bz2 && \
97 cd sbcl-${SBCL_VERSION}-x86-64-linux && \
98 ./install.sh && \
99 sbcl --version && \
100 cd .. && \
101 rm -rf sbcl*
102
103ENV D_VERSION 2.087.0
104ENV DMD_DEB dmd_2.087.0-0_amd64.deb
105RUN \
106 `# D dependencies` \
107 wget -q http://downloads.dlang.org/releases/2.x/${D_VERSION}/${DMD_DEB} && \
108 dpkg --install ${DMD_DEB} && \
109 rm -f ${DMD_DEB} && \
110 mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \
111 git clone -b 'v2.0.2+2.0.16' https://github.com/D-Programming-Deimos/libevent.git deimos-libevent-2.0 && \
112 mv deimos-libevent-2.0/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
113 mv deimos-libevent-2.0/C/* /usr/include/dmd/druntime/import/C/ && \
114 rm -rf deimos-libevent-2.0 && \
115 git clone -b 'v2.0.0+1.1.0h' https://github.com/D-Programming-Deimos/openssl.git deimos-openssl-1.1.0h && \
116 mv deimos-openssl-1.1.0h/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
117 mv deimos-openssl-1.1.0h/C/* /usr/include/dmd/druntime/import/C/ && \
118 rm -rf deimos-openssl-1.1.0h
119
120ENV DART_VERSION 2.7.2-1
121RUN apt-get install -y --no-install-recommends \
122 `# Dart dependencies` \
123 dart=$DART_VERSION
124ENV PATH /usr/lib/dart/bin:$PATH
125
126RUN apt-get install -y --no-install-recommends \
127 `# dotnet core dependencies` \
Jens Geyer4115e952023-11-21 23:00:01 +0100128 dotnet-sdk-8.0 \
129 dotnet-runtime-8.0 \
130 aspnetcore-runtime-8.0 \
131 dotnet-apphost-pack-8.0
Jiayu Liu564b2872022-10-12 11:42:38 +0800132
133# Erlang dependencies
134ARG ERLANG_OTP_VERSION=23.3.4.11
135ARG ERLANG_REBAR_VERSION=3.18.0
136RUN apt-get update && apt-get install -y --no-install-recommends libncurses5-dev && \
137 curl -ssLo /usr/local/bin/kerl https://raw.githubusercontent.com/kerl/kerl/master/kerl && chmod +x /usr/local/bin/kerl && \
138 kerl build $ERLANG_OTP_VERSION && kerl install $ERLANG_OTP_VERSION /usr/local/lib/otp/ && . /usr/local/lib/otp/activate && \
139 curl -ssLo /usr/local/bin/rebar3 https://github.com/erlang/rebar3/releases/download/${ERLANG_REBAR_VERSION}/rebar3 && chmod +x /usr/local/bin/rebar3 && \
140 rebar3 --version
141ENV PATH /usr/local/lib/otp/bin:$PATH
142
143RUN apt-get install -y --no-install-recommends \
144 `# GlibC dependencies` \
145 libglib2.0-dev
146
147# golang
Yuxuan 'fishy' Wangb94eac72023-02-02 09:41:31 -0800148ENV GOLANG_VERSION 1.20
Jiayu Liu564b2872022-10-12 11:42:38 +0800149ENV GOLANG_DOWNLOAD_URL https://go.dev/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
Yuxuan 'fishy' Wangb94eac72023-02-02 09:41:31 -0800150ENV GOLANG_DOWNLOAD_SHA256 5a9ebcc65c1cce56e0d2dc616aff4c4cedcfbda8cc6f0288cc08cda3b18dcbf1
Jiayu Liu564b2872022-10-12 11:42:38 +0800151RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz && \
152 echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - && \
153 tar -C /usr/local -xzf golang.tar.gz && \
154 ln -s /usr/local/go/bin/go /usr/local/bin && \
155 rm golang.tar.gz
156
157RUN apt-get install -y --no-install-recommends \
158 `# Haxe dependencies` \
159 haxe \
160 neko \
161 neko-dev && \
162 haxelib setup --always /usr/share/haxe/lib && \
163 haxelib install --always hxcpp 2>&1 > /dev/null
164
Jiayu Liud40dd722023-10-19 08:37:49 +0800165ENV GRADLE_VERSION="8.4"
Jiayu Liu564b2872022-10-12 11:42:38 +0800166RUN apt-get install -y --no-install-recommends \
167 `# Java dependencies` \
168 ant \
169 ant-optional \
170 maven \
171 openjdk-11-jdk-headless && \
172 `# Gradle` \
173 wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip && \
Jiayu Liud40dd722023-10-19 08:37:49 +0800174 (echo "3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -) && \
Jiayu Liu564b2872022-10-12 11:42:38 +0800175 unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip && \
176 mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle && \
177 ln -s /usr/local/gradle/bin/gradle /usr/local/bin
178
179RUN apt-get install -y --no-install-recommends \
180 `# Lua dependencies` \
181 lua5.2 \
182 lua5.2-dev
183# https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212
184# lua5.3 does not install alternatives!
185# need to update our luasocket code, lua doesn't have luaL_openlib any more
186
187RUN apt-get install -y --no-install-recommends \
188 `# Node.js dependencies` \
189 nodejs
190
191# Test dependencies for running puppeteer
192RUN apt-get install -y --no-install-recommends \
193 `# JS dependencies` \
194 libxss1 \
195 libxtst6
196
197RUN apt-get install -y --no-install-recommends \
198 `# OCaml dependencies` \
199 ocaml \
200 opam && \
201 `# disable sandboxing see https://github.com/ocaml/opam/issues/4327` \
202 opam init --yes --disable-sandboxing && \
203 opam install --yes oasis
204
205RUN apt-get install -y --no-install-recommends \
206 `# Perl dependencies` \
207 libbit-vector-perl \
208 libclass-accessor-class-perl \
209 libcrypt-ssleay-perl \
210 libio-socket-ssl-perl \
211 libnet-ssleay-perl \
212 libtest-exception-perl
213
214RUN apt-get install -y --no-install-recommends \
215 `# Php dependencies` \
216 php \
217 php-cli \
218 php-dev \
219 php-json \
220 php-pear \
221 re2c \
222 composer
223
224RUN apt-get install -y --no-install-recommends \
225 `# Python3 dependencies` \
226 python3-all \
227 python3-all-dbg \
228 python3-all-dev \
229 python3-pip \
230 python3-setuptools \
231 python3-six \
232 python3-tornado \
233 python3-twisted \
234 python3-wheel \
235 python3-zope.interface
236
237RUN apt-get install -y --no-install-recommends \
238 `# Ruby dependencies` \
239 ruby \
240 ruby-dev \
241 ruby-bundler
242
243# Rust dependencies
Jiayu Liufbfa52c2023-11-07 13:47:24 +0800244RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.65.0 -y
Jiayu Liu564b2872022-10-12 11:42:38 +0800245ENV PATH /root/.cargo/bin:$PATH
246
247# Swift on Linux for cross tests
248RUN apt-get install -yq \
249 libedit-dev \
250 libz3-dev \
251 libpython2-dev \
252 libxml2-dev && \
253 cd / && \
254 wget --quiet https://download.swift.org/swift-5.7-release/ubuntu2204/swift-5.7-RELEASE/swift-5.7-RELEASE-ubuntu22.04.tar.gz && \
Kino Royc4954482022-11-19 22:52:04 -0800255 tar xf swift-5.7-RELEASE-ubuntu22.04.tar.gz && \
256 mv swift-5.7-RELEASE-ubuntu22.04 /usr/share/swift && \
257 rm swift-5.7-RELEASE-ubuntu22.04.tar.gz
258
259ENV PATH /usr/share/swift/usr/bin:$PATH
260RUN swift --version
Jiayu Liu564b2872022-10-12 11:42:38 +0800261
262# Locale(s) for cpp unit tests
263RUN apt-get install -y --no-install-recommends \
264 `# Locale dependencies` \
265 locales && \
266 locale-gen en_US.UTF-8 && \
267 locale-gen de_DE.UTF-8 && \
268 update-locale
269
270RUN apt-get install -y --no-install-recommends \
271 `# Static Code Analysis dependencies` \
272 cppcheck \
273 sloccount && \
274 pip install flake8
275
276# NOTE: this does not reduce the image size but adds an additional layer.
277# # Clean up
278# RUN rm -rf /var/cache/apt/* && \
279# rm -rf /var/lib/apt/lists/* && \
280# rm -rf /tmp/* && \
281# rm -rf /var/tmp/*
282
283ENV THRIFT_ROOT /thrift
284RUN mkdir -p $THRIFT_ROOT/src
285COPY Dockerfile $THRIFT_ROOT/
286WORKDIR $THRIFT_ROOT/src