blob: 84bbee1beae8a9b40ffc5ece0ebdda93a55bcf75 [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}" && \
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 Liuf027dee2022-09-19 14:26:37 +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/20.04/prod.list && \
Jiayu Liuf027dee2022-09-19 14:26:37 +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
Jiayu Liuc5d03242022-09-26 23:04:26 +080065RUN apt-get update -yq && \
66 apt-get install -y --no-install-recommends \
Jiayu Liuf027dee2022-09-19 14:26:37 +080067 `# 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 \
101 qt5-default \
102 qtbase5-dev \
103 qtbase5-dev-tools
104
105ENV SBCL_VERSION 1.5.3
106RUN \
107 `# Common Lisp (sbcl) dependencies` \
108 curl --version && \
109 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# && \
110 tar xjf sbcl-${SBCL_VERSION}-x86-64-linux-binary.tar.bz2 && \
111 cd sbcl-${SBCL_VERSION}-x86-64-linux && \
112 ./install.sh && \
113 sbcl --version && \
114 cd .. && \
115 rm -rf sbcl*
116
117ENV D_VERSION 2.087.0
118ENV DMD_DEB dmd_2.087.0-0_amd64.deb
119RUN \
120 `# D dependencies` \
121 wget -q http://downloads.dlang.org/releases/2.x/${D_VERSION}/${DMD_DEB} && \
122 dpkg --install ${DMD_DEB} && \
123 rm -f ${DMD_DEB} && \
124 mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \
125 git clone -b 'v2.0.2+2.0.16' https://github.com/D-Programming-Deimos/libevent.git deimos-libevent-2.0 && \
126 mv deimos-libevent-2.0/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
127 mv deimos-libevent-2.0/C/* /usr/include/dmd/druntime/import/C/ && \
128 rm -rf deimos-libevent-2.0 && \
129 git clone -b 'v2.0.0+1.1.0h' https://github.com/D-Programming-Deimos/openssl.git deimos-openssl-1.1.0h && \
130 mv deimos-openssl-1.1.0h/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
131 mv deimos-openssl-1.1.0h/C/* /usr/include/dmd/druntime/import/C/ && \
132 rm -rf deimos-openssl-1.1.0h
133
134ENV DART_VERSION 2.7.2-1
135RUN apt-get install -y --no-install-recommends \
136 `# Dart dependencies` \
137 dart=$DART_VERSION
138ENV PATH /usr/lib/dart/bin:$PATH
139
140RUN apt-get install -y --no-install-recommends \
141 `# dotnet core dependencies` \
Jens Geyer4115e952023-11-21 23:00:01 +0100142 dotnet-sdk-8.0 \
143 dotnet-runtime-8.0 \
144 aspnetcore-runtime-8.0 \
145 dotnet-apphost-pack-8.0
Jiayu Liuf027dee2022-09-19 14:26:37 +0800146
147# Erlang dependencies
148ARG ERLANG_OTP_VERSION=23.3.4.11
149ARG ERLANG_REBAR_VERSION=3.18.0
150RUN apt-get update && apt-get install -y --no-install-recommends libncurses5-dev && \
151 curl -ssLo /usr/local/bin/kerl https://raw.githubusercontent.com/kerl/kerl/master/kerl && chmod +x /usr/local/bin/kerl && \
152 kerl build $ERLANG_OTP_VERSION && kerl install $ERLANG_OTP_VERSION /usr/local/lib/otp/ && . /usr/local/lib/otp/activate && \
153 curl -ssLo /usr/local/bin/rebar3 https://github.com/erlang/rebar3/releases/download/${ERLANG_REBAR_VERSION}/rebar3 && chmod +x /usr/local/bin/rebar3 && \
154 rebar3 --version
155ENV PATH /usr/local/lib/otp/bin:$PATH
156
157RUN apt-get install -y --no-install-recommends \
158 `# GlibC dependencies` \
159 libglib2.0-dev
160
161# golang
Thomasfd29ab12024-02-28 20:40:30 +0900162ENV GOLANG_VERSION 1.21.7
Jiayu Liuf027dee2022-09-19 14:26:37 +0800163ENV GOLANG_DOWNLOAD_URL https://go.dev/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
Thomasfd29ab12024-02-28 20:40:30 +0900164ENV GOLANG_DOWNLOAD_SHA256 13b76a9b2a26823e53062fa841b07087d48ae2ef2936445dc34c4ae03293702c
Jiayu Liuf027dee2022-09-19 14:26:37 +0800165RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz && \
166 echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - && \
167 tar -C /usr/local -xzf golang.tar.gz && \
168 ln -s /usr/local/go/bin/go /usr/local/bin && \
169 rm golang.tar.gz
170
Thomas67685842024-03-04 21:32:26 +0900171# HAXE
172ARG HAXE_VERSION=4.2.1
173ARG NEKO_VERSION=2.3.0
174RUN cd $HOME && \
175 `# Haxe dependencies` && \
176 wget https://github.com/HaxeFoundation/haxe/releases/download/${HAXE_VERSION}/haxe-${HAXE_VERSION}-linux64.tar.gz && \
177 tar xvf haxe-${HAXE_VERSION}-linux64.tar.gz && \
178 rm haxe-${HAXE_VERSION}-linux64.tar.gz && \
179 mv haxe_* /opt/haxe && \
180 wget https://github.com/HaxeFoundation/neko/releases/download/v`echo ${NEKO_VERSION} | sed "s/\./-/g"`/neko-${NEKO_VERSION}-linux64.tar.gz && \
181 tar xvf neko-${NEKO_VERSION}-linux64.tar.gz && \
182 rm neko-${NEKO_VERSION}-linux64.tar.gz && \
183 mv neko-* /opt/neko
184ENV PATH /opt/haxe:/opt/neko:$PATH
185RUN echo "/opt/neko" > /etc/ld.so.conf.d/neko.conf && \
Thomas5f563e92024-03-06 23:26:22 +0900186 ldconfig
187USER ${user}
188RUN mkdir -p $HOME/haxe/lib && \
189 haxelib setup --always $HOME/haxe/lib && \
190 haxelib install --always hxcpp 2>&1 > /dev/null && \
191 haxelib install --always uuid 2>&1 > /dev/null
192USER root
Jiayu Liuf027dee2022-09-19 14:26:37 +0800193
Jiayu Liud40dd722023-10-19 08:37:49 +0800194ENV GRADLE_VERSION="8.4"
Jiayu Liuf027dee2022-09-19 14:26:37 +0800195RUN apt-get install -y --no-install-recommends \
196 `# Java dependencies` \
197 ant \
198 ant-optional \
199 maven \
Jiayu Liu92b007f2022-10-14 13:16:18 +0800200 openjdk-17-jdk-headless && \
Jiayu Liuf027dee2022-09-19 14:26:37 +0800201 `# Gradle` \
202 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 +0800203 (echo "3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -) && \
Jiayu Liuf027dee2022-09-19 14:26:37 +0800204 unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip && \
205 mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle && \
206 ln -s /usr/local/gradle/bin/gradle /usr/local/bin
207
208RUN apt-get install -y --no-install-recommends \
209 `# Lua dependencies` \
210 lua5.2 \
211 lua5.2-dev
212# https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212
213# lua5.3 does not install alternatives!
214# need to update our luasocket code, lua doesn't have luaL_openlib any more
215
216RUN apt-get install -y --no-install-recommends \
217 `# Node.js dependencies` \
218 nodejs
219
220# Test dependencies for running puppeteer
221RUN apt-get install -y --no-install-recommends \
222 `# JS dependencies` \
223 libxss1 \
224 libxtst6
225
226RUN apt-get install -y --no-install-recommends \
227 `# OCaml dependencies` \
228 ocaml \
229 opam && \
Jiayu Liufb7df3c2022-09-24 08:59:30 +0800230 `# disable sandboxing see https://github.com/ocaml/opam/issues/4327` \
231 opam init --yes --disable-sandboxing && \
Jiayu Liuf027dee2022-09-19 14:26:37 +0800232 opam install --yes oasis
233
234RUN apt-get install -y --no-install-recommends \
235 `# Perl dependencies` \
236 libbit-vector-perl \
237 libclass-accessor-class-perl \
238 libcrypt-ssleay-perl \
239 libio-socket-ssl-perl \
240 libnet-ssleay-perl \
241 libtest-exception-perl
242
243RUN apt-get install -y --no-install-recommends \
244 `# Php dependencies` \
Thomasf5155172024-03-05 22:13:22 +0900245 php7.4 \
246 php7.4-cli \
247 php7.4-dev \
248 php7.4-mbstring \
249 php7.4-xml \
250 php7.4-curl \
251 php7.4-xdebug \
Jiayu Liuf027dee2022-09-19 14:26:37 +0800252 php-pear \
253 re2c \
254 composer
255
256RUN apt-get install -y --no-install-recommends \
257 `# Python3 dependencies` \
258 python3-all \
259 python3-all-dbg \
260 python3-all-dev \
261 python3-pip \
262 python3-setuptools \
Jiayu Liuf027dee2022-09-19 14:26:37 +0800263 python3-tornado \
264 python3-twisted \
265 python3-wheel \
266 python3-zope.interface
267
268RUN apt-get install -y --no-install-recommends \
269 `# Ruby dependencies` \
270 ruby \
271 ruby-dev \
272 ruby-bundler
273
Thomas67685842024-03-04 21:32:26 +0900274USER ${user}
275RUN `# Rust dependencies` \
276 curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.65.0 -y
277ENV PATH /home/${user}/.cargo/bin:$PATH
278USER root
Jiayu Liuf027dee2022-09-19 14:26:37 +0800279
280# Swift on Linux for cross tests
Jiayu Liuc5d03242022-09-26 23:04:26 +0800281RUN apt-get install -yq \
282 libedit-dev \
283 libz3-dev \
284 libpython2-dev \
285 libxml2-dev && \
286 cd / && \
Kino Royc4954482022-11-19 22:52:04 -0800287 wget --quiet https://download.swift.org/swift-5.7-release/ubuntu2004/swift-5.7-RELEASE/swift-5.7-RELEASE-ubuntu20.04.tar.gz && \
288 tar xf swift-5.7-RELEASE-ubuntu20.04.tar.gz && \
289 mv swift-5.7-RELEASE-ubuntu20.04 /usr/share/swift && \
290 rm swift-5.7-RELEASE-ubuntu20.04.tar.gz
291
292ENV PATH /usr/share/swift/usr/bin:$PATH
293RUN swift --version
Jiayu Liuf027dee2022-09-19 14:26:37 +0800294
295# Locale(s) for cpp unit tests
296RUN apt-get install -y --no-install-recommends \
297 `# Locale dependencies` \
298 locales && \
299 locale-gen en_US.UTF-8 && \
300 locale-gen de_DE.UTF-8 && \
301 update-locale
302
Jiayu Liuf027dee2022-09-19 14:26:37 +0800303RUN apt-get install -y --no-install-recommends \
304 `# Static Code Analysis dependencies` \
305 cppcheck \
306 sloccount && \
Jiayu Liuc5d03242022-09-26 23:04:26 +0800307 pip install flake8
Jiayu Liuf027dee2022-09-19 14:26:37 +0800308
309# NOTE: this does not reduce the image size but adds an additional layer.
310# # Clean up
311# RUN rm -rf /var/cache/apt/* && \
312# rm -rf /var/lib/apt/lists/* && \
313# rm -rf /tmp/* && \
314# rm -rf /var/tmp/*
315
316ENV THRIFT_ROOT /thrift
Thomasc890ed42024-02-25 19:58:30 +0900317RUN mkdir -p $THRIFT_ROOT/src && \
318 chown -R ${uid}:${uid} $THRIFT_ROOT/
Jiayu Liuf027dee2022-09-19 14:26:37 +0800319COPY Dockerfile $THRIFT_ROOT/
320WORKDIR $THRIFT_ROOT/src
Thomasc890ed42024-02-25 19:58:30 +0900321
322USER ${user}