|
| 1 | +# Ubuntu version |
| 2 | +ARG RELEASE=24.04 |
| 3 | + |
| 4 | +# Build stage |
| 5 | +FROM ubuntu:${RELEASE} AS builder |
| 6 | + |
| 7 | + |
| 8 | +# Build-time variables |
| 9 | +ARG DEBIAN_FRONTEND=noninteractive |
| 10 | +ARG BUILDARCH |
| 11 | + |
| 12 | + |
| 13 | +# Stage-wide dependencies |
| 14 | +RUN apt update && \ |
| 15 | + apt install --no-install-recommends --no-install-suggests --yes \ |
| 16 | + build-essential \ |
| 17 | + ca-certificates \ |
| 18 | + curl |
| 19 | + |
| 20 | + |
| 21 | +# Install Java 24.x |
| 22 | +# http://jdk.java.net/24/ |
| 23 | +RUN cd /tmp && \ |
| 24 | + if [ "$BUILDARCH" = "arm64" ]; then ARCH="aarch64"; else ARCH="x64"; fi && \ |
| 25 | + curl --remote-name https://download.java.net/java/GA/jdk24.0.2/fdc5d0102fe0414db21410ad5834341f/12/GPL/openjdk-24.0.2_linux-${ARCH}_bin.tar.gz && \ |
| 26 | + tar xzf openjdk-24.0.2_linux-${ARCH}_bin.tar.gz && \ |
| 27 | + rm --force openjdk-24.0.2_linux-${ARCH}_bin.tar.gz && \ |
| 28 | + mv jdk-24.0.2 /opt/jdk && \ |
| 29 | + mkdir --parent /opt/bin && \ |
| 30 | + ln --symbolic /opt/jdk/bin/* /opt/bin/ && \ |
| 31 | + chmod a+rx /opt/bin/* |
| 32 | + |
| 33 | + |
| 34 | +# Install Node.js 22.x |
| 35 | +# https://nodejs.dev/en/download/ |
| 36 | +# https://github.com/tj/n#installation |
| 37 | +RUN curl --location https://raw.githubusercontent.com/tj/n/master/bin/n --output /usr/local/bin/n && \ |
| 38 | + chmod a+x /usr/local/bin/n && \ |
| 39 | + n 22.21.1 |
| 40 | + |
| 41 | + |
| 42 | +# Install Node.js packages |
| 43 | +RUN npm install --global \ |
| 44 | + http-server@14.1.1 |
| 45 | + |
| 46 | + |
| 47 | +# Patch index.js in http-server |
| 48 | +COPY index.js.patch /tmp |
| 49 | +RUN cd /usr/local/lib/node_modules/http-server/lib/core/show-dir && \ |
| 50 | + patch index.js < /tmp/index.js.patch && \ |
| 51 | + rm --force /tmp/index.js.patch |
| 52 | + |
| 53 | + |
| 54 | +# Suggested build environment for Python, per pyenv, even though we're building ourselves |
| 55 | +# https://github.com/pyenv/pyenv/wiki#suggested-build-environment |
| 56 | +RUN apt update && \ |
| 57 | + apt install --no-install-recommends --no-install-suggests --yes \ |
| 58 | + build-essential ca-certificates curl git \ |
| 59 | + libssl-dev libbz2-dev libreadline-dev libsqlite3-dev \ |
| 60 | + llvm libncursesw5-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \ |
| 61 | + make tk-dev unzip wget xz-utils zlib1g-dev |
| 62 | + |
| 63 | + |
| 64 | +# Install Python 3.13.x |
| 65 | +# https://www.python.org/downloads/ |
| 66 | +RUN cd /tmp && \ |
| 67 | + curl --remote-name https://www.python.org/ftp/python/3.13.11/Python-3.13.11.tgz && \ |
| 68 | + tar xzf Python-3.13.11.tgz && \ |
| 69 | + rm --force Python-3.13.11.tgz && \ |
| 70 | + cd Python-3.13.11 && \ |
| 71 | + CFLAGS="-Os" ./configure --disable-static --enable-optimizations --enable-shared --with-lto --without-tests && \ |
| 72 | + ./configure && \ |
| 73 | + make && \ |
| 74 | + make install && \ |
| 75 | + cd .. && \ |
| 76 | + rm --force --recursive Python-3.13.11 && \ |
| 77 | + ln --relative --symbolic /usr/local/bin/pip3 /usr/local/bin/pip && \ |
| 78 | + ln --relative --symbolic /usr/local/bin/python3 /usr/local/bin/python && \ |
| 79 | + pip3 install --no-cache-dir --upgrade pip |
| 80 | + |
| 81 | + |
| 82 | +# Install Ruby 3.4.x |
| 83 | +# https://www.ruby-lang.org/en/downloads/ |
| 84 | +# https://bugs.ruby-lang.org/issues/20085#note-5 |
| 85 | +RUN apt update && \ |
| 86 | + apt install --no-install-recommends --no-install-suggests --yes \ |
| 87 | + autoconf \ |
| 88 | + libyaml-dev && \ |
| 89 | + apt clean && \ |
| 90 | + rm --force --recursive /var/lib/apt/lists/* && \ |
| 91 | + cd /tmp && \ |
| 92 | + curl https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.1.tar.gz --output ruby-4.0.1.tar.gz && \ |
| 93 | + tar xzf ruby-4.0.1.tar.gz && \ |
| 94 | + rm --force ruby-4.0.1.tar.gz && \ |
| 95 | + cd ruby-4.0.1 && \ |
| 96 | + if [ "$BUILDARCH" = "arm64" ]; then ASFLAGS=-mbranch-protection=pac-ret; else ASFLAGS=; fi && \ |
| 97 | + ASFLAGS=${ASFLAGS} CFLAGS=-Os ./configure --disable-install-doc --enable-load-relative && \ |
| 98 | + make && \ |
| 99 | + make install && \ |
| 100 | + cd .. && \ |
| 101 | + rm --force --recursive ruby-4.0.1 |
0 commit comments