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