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