blob: 3dffc5811574de58f26a08d35e717b17d0a5746a [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
24RUN apt-get update && \
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 && apt-get install -y --no-install-recommends \
52 `# General dependencies` \
53 bash-completion \
54 bison \
55 build-essential \
56 clang \
57 cmake \
58 debhelper \
59 flex \
60 gdb \
61 libasound2 \
62 libatk-bridge2.0-0 \
63 libgtk-3-0 \
64 llvm \
65 ninja-build \
66 pkg-config \
67 unzip \
68 valgrind \
69 vim
70ENV PATH /usr/lib/llvm-6.0/bin:$PATH
71
72# lib/as3 (ActionScript)
73RUN mkdir -p /usr/local/adobe/flex/4.6 && \
74 cd /usr/local/adobe/flex/4.6 && \
75 wget -q "http://download.macromedia.com/pub/flex/sdk/flex_sdk_4.6.zip" && \
76 unzip flex_sdk_4.6.zip
77ENV FLEX_HOME /usr/local/adobe/flex/4.6
78
79# TODO: "apt-get install" without "apt-get update" in the same "RUN" step can cause cache issues if modified later.
80# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
81RUN apt-get install -y --no-install-recommends \
82 `# C++ dependencies` \
83 libboost-all-dev \
84 libevent-dev \
85 libssl-dev \
86 qt5-default \
87 qtbase5-dev \
88 qtbase5-dev-tools
89
90ENV SBCL_VERSION 1.5.3
91RUN \
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
102ENV D_VERSION 2.087.0
103ENV DMD_DEB dmd_2.087.0-0_amd64.deb
104RUN \
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
119ENV DART_VERSION 2.7.2-1
120RUN apt-get install -y --no-install-recommends \
121 `# Dart dependencies` \
122 dart=$DART_VERSION
123ENV PATH /usr/lib/dart/bin:$PATH
124
125RUN apt-get install -y --no-install-recommends \
126 `# dotnet core dependencies` \
127 dotnet-sdk-6.0 \
128 dotnet-runtime-6.0 \
129 aspnetcore-runtime-6.0 \
130 dotnet-apphost-pack-6.0
131
132# Erlang dependencies
133ARG ERLANG_OTP_VERSION=23.3.4.11
134ARG ERLANG_REBAR_VERSION=3.18.0
135RUN 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
140ENV PATH /usr/local/lib/otp/bin:$PATH
141
142RUN apt-get install -y --no-install-recommends \
143 `# GlibC dependencies` \
144 libglib2.0-dev
145
146# golang
147ENV GOLANG_VERSION 1.19
148ENV GOLANG_DOWNLOAD_URL https://go.dev/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
149ENV GOLANG_DOWNLOAD_SHA256 464b6b66591f6cf055bc5df90a9750bf5fbc9d038722bb84a9d56a2bea974be6
150RUN 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
156RUN 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
164ENV GRADLE_VERSION="7.5.1"
165RUN apt-get install -y --no-install-recommends \
166 `# Java dependencies` \
167 ant \
168 ant-optional \
169 maven \
170 openjdk-17-jdk-headless && \
171 `# Gradle` \
172 wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip && \
173 (echo "f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -) && \
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
178RUN 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
186RUN apt-get install -y --no-install-recommends \
187 `# Node.js dependencies` \
188 nodejs
189
190# Test dependencies for running puppeteer
191RUN apt-get install -y --no-install-recommends \
192 `# JS dependencies` \
193 libxss1 \
194 libxtst6
195
196RUN apt-get install -y --no-install-recommends \
197 `# OCaml dependencies` \
198 ocaml \
199 opam && \
200 opam init --yes && \
201 opam install --yes oasis
202
203RUN apt-get install -y --no-install-recommends \
204 `# Perl dependencies` \
205 libbit-vector-perl \
206 libclass-accessor-class-perl \
207 libcrypt-ssleay-perl \
208 libio-socket-ssl-perl \
209 libnet-ssleay-perl \
210 libtest-exception-perl
211
212RUN apt-get install -y --no-install-recommends \
213 `# Php dependencies` \
214 php \
215 php-cli \
216 php-dev \
217 php-json \
218 php-pear \
219 re2c \
220 composer
221
222RUN apt-get install -y --no-install-recommends \
223 `# Python3 dependencies` \
224 python3-all \
225 python3-all-dbg \
226 python3-all-dev \
227 python3-pip \
228 python3-setuptools \
229 python3-six \
230 python3-tornado \
231 python3-twisted \
232 python3-wheel \
233 python3-zope.interface
234
235RUN apt-get install -y --no-install-recommends \
236 `# Ruby dependencies` \
237 ruby \
238 ruby-dev \
239 ruby-bundler
240
241# Rust dependencies
242RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.61.0 -y
243ENV PATH /root/.cargo/bin:$PATH
244
245# Swift on Linux for cross tests
246RUN cd / && \
247 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 && \
248 tar xf swift-5.3.3-RELEASE-ubuntu20.04.tar.gz --strip-components=1 && \
249 rm swift-5.3.3-RELEASE-ubuntu20.04.tar.gz && \
250 swift --version
251
252# Locale(s) for cpp unit tests
253RUN apt-get install -y --no-install-recommends \
254 `# Locale dependencies` \
255 locales && \
256 locale-gen en_US.UTF-8 && \
257 locale-gen de_DE.UTF-8 && \
258 update-locale
259
260# cppcheck-1.82 has a nasty cpp parser bug, so we're using something newer
261RUN apt-get install -y --no-install-recommends \
262 `# Static Code Analysis dependencies` \
263 cppcheck \
264 sloccount && \
265 pip install flake8 && \
266 wget -q "https://launchpad.net/ubuntu/+source/cppcheck/1.83-2/+build/14874703/+files/cppcheck_1.83-2_amd64.deb" && \
267 dpkg -i cppcheck_1.83-2_amd64.deb && \
268 rm cppcheck_1.83-2_amd64.deb
269
270# NOTE: this does not reduce the image size but adds an additional layer.
271# # Clean up
272# RUN rm -rf /var/cache/apt/* && \
273# rm -rf /var/lib/apt/lists/* && \
274# rm -rf /tmp/* && \
275# rm -rf /var/tmp/*
276
277ENV THRIFT_ROOT /thrift
278RUN mkdir -p $THRIFT_ROOT/src
279COPY Dockerfile $THRIFT_ROOT/
280WORKDIR $THRIFT_ROOT/src