blob: 0ea27800b380d74c1ac89c97bcbe5046dcabf5c5 [file] [log] [blame]
Jiayu Liuf027dee2022-09-19 14:26:37 +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 Focal
15# with some updated packages.
16#
17
18FROM buildpack-deps:focal-scm
19LABEL MAINTAINER="Apache Thrift <dev@thrift.apache.org>"
20ENV DEBIAN_FRONTEND=noninteractive
21
22### Add apt repos
23
Jiayu Liuc5d03242022-09-26 23:04:26 +080024RUN apt-get update -yq && \
Jiayu Liuf027dee2022-09-19 14:26:37 +080025 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
Jiayu Liuc5d03242022-09-26 23:04:26 +080051RUN apt-get update -yq && \
52 apt-get install -y --no-install-recommends \
Jiayu Liuf027dee2022-09-19 14:26:37 +080053 `# 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` \
128 dotnet-sdk-6.0 \
129 dotnet-runtime-6.0 \
130 aspnetcore-runtime-6.0 \
131 dotnet-apphost-pack-6.0
132
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
Hamza Anis32bd0bd2022-10-11 08:47:11 +0500148ENV GOLANG_VERSION 1.19.2
Jiayu Liuf027dee2022-09-19 14:26:37 +0800149ENV GOLANG_DOWNLOAD_URL https://go.dev/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
Hamza Anis32bd0bd2022-10-11 08:47:11 +0500150ENV GOLANG_DOWNLOAD_SHA256 5e8c5a74fe6470dd7e055a461acda8bb4050ead8c2df70f227e3ff7d8eb7eeb6
Jiayu Liuf027dee2022-09-19 14:26:37 +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
165ENV GRADLE_VERSION="7.5.1"
166RUN apt-get install -y --no-install-recommends \
167 `# Java dependencies` \
168 ant \
169 ant-optional \
170 maven \
Jiayu Liuf31c5882022-09-27 14:06:57 +0800171 openjdk-11-jdk-headless && \
Jiayu Liuf027dee2022-09-19 14:26:37 +0800172 `# Gradle` \
173 wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip && \
174 (echo "f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -) && \
175 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 && \
Jiayu Liufb7df3c2022-09-24 08:59:30 +0800201 `# disable sandboxing see https://github.com/ocaml/opam/issues/4327` \
202 opam init --yes --disable-sandboxing && \
Jiayu Liuf027dee2022-09-19 14:26:37 +0800203 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
244RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.61.0 -y
245ENV PATH /root/.cargo/bin:$PATH
246
247# Swift on Linux for cross tests
Jiayu Liuc5d03242022-09-26 23:04:26 +0800248RUN apt-get install -yq \
249 libedit-dev \
250 libz3-dev \
251 libpython2-dev \
252 libxml2-dev && \
253 cd / && \
Jiayu Liuf027dee2022-09-19 14:26:37 +0800254 wget --quiet https://swift.org/builds/swift-5.3.3-release/ubuntu2004/swift-5.3.3-RELEASE/swift-5.3.3-RELEASE-ubuntu20.04.tar.gz && \
255 tar xf swift-5.3.3-RELEASE-ubuntu20.04.tar.gz --strip-components=1 && \
256 rm swift-5.3.3-RELEASE-ubuntu20.04.tar.gz && \
257 swift --version
258
259# Locale(s) for cpp unit tests
260RUN apt-get install -y --no-install-recommends \
261 `# Locale dependencies` \
262 locales && \
263 locale-gen en_US.UTF-8 && \
264 locale-gen de_DE.UTF-8 && \
265 update-locale
266
Jiayu Liuf027dee2022-09-19 14:26:37 +0800267RUN apt-get install -y --no-install-recommends \
268 `# Static Code Analysis dependencies` \
269 cppcheck \
270 sloccount && \
Jiayu Liuc5d03242022-09-26 23:04:26 +0800271 pip install flake8
Jiayu Liuf027dee2022-09-19 14:26:37 +0800272
273# NOTE: this does not reduce the image size but adds an additional layer.
274# # Clean up
275# RUN rm -rf /var/cache/apt/* && \
276# rm -rf /var/lib/apt/lists/* && \
277# rm -rf /tmp/* && \
278# rm -rf /var/tmp/*
279
280ENV THRIFT_ROOT /thrift
281RUN mkdir -p $THRIFT_ROOT/src
282COPY Dockerfile $THRIFT_ROOT/
283WORKDIR $THRIFT_ROOT/src