mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 05:22:56 +00:00
The [2.31.0 release](https://github.com/rui314/mold/releases/tag/v2.31.0) of mold includes a 10% speed improvement for binaries with a lot of debug info. As we have such, it might be useful to update mold to the latest release. The jump is from 2.4.0 to 2.31.0, but it's not been many releases in between as the version number was raised by the mold maintainers to 2.30.0 after 2.4.1 [to avoid confusion for some tools](https://github.com/rui314/mold/releases/tag/v2.30.0).
173 lines
6.0 KiB
Docker
173 lines
6.0 KiB
Docker
FROM debian:bullseye-slim
|
|
|
|
# Add nonroot user
|
|
RUN useradd -ms /bin/bash nonroot -b /home
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
# System deps
|
|
RUN set -e \
|
|
&& apt update \
|
|
&& apt install -y \
|
|
autoconf \
|
|
automake \
|
|
bison \
|
|
build-essential \
|
|
ca-certificates \
|
|
cmake \
|
|
curl \
|
|
flex \
|
|
git \
|
|
gnupg \
|
|
gzip \
|
|
jq \
|
|
libcurl4-openssl-dev \
|
|
libbz2-dev \
|
|
libffi-dev \
|
|
liblzma-dev \
|
|
libncurses5-dev \
|
|
libncursesw5-dev \
|
|
libpq-dev \
|
|
libreadline-dev \
|
|
libseccomp-dev \
|
|
libsqlite3-dev \
|
|
libssl-dev \
|
|
libstdc++-10-dev \
|
|
libtool \
|
|
libxml2-dev \
|
|
libxmlsec1-dev \
|
|
libxxhash-dev \
|
|
lsof \
|
|
make \
|
|
netcat \
|
|
net-tools \
|
|
openssh-client \
|
|
parallel \
|
|
pkg-config \
|
|
unzip \
|
|
wget \
|
|
xz-utils \
|
|
zlib1g-dev \
|
|
zstd \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
# protobuf-compiler (protoc)
|
|
ENV PROTOC_VERSION 25.1
|
|
RUN curl -fsSL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-$(uname -m | sed 's/aarch64/aarch_64/g').zip" -o "protoc.zip" \
|
|
&& unzip -q protoc.zip -d protoc \
|
|
&& mv protoc/bin/protoc /usr/local/bin/protoc \
|
|
&& mv protoc/include/google /usr/local/include/google \
|
|
&& rm -rf protoc.zip protoc
|
|
|
|
# s5cmd
|
|
ENV S5CMD_VERSION=2.2.2
|
|
RUN curl -sL "https://github.com/peak/s5cmd/releases/download/v${S5CMD_VERSION}/s5cmd_${S5CMD_VERSION}_Linux-$(uname -m | sed 's/x86_64/64bit/g' | sed 's/aarch64/arm64/g').tar.gz" | tar zxvf - s5cmd \
|
|
&& chmod +x s5cmd \
|
|
&& mv s5cmd /usr/local/bin/s5cmd
|
|
|
|
# LLVM
|
|
ENV LLVM_VERSION=18
|
|
RUN curl -fsSL 'https://apt.llvm.org/llvm-snapshot.gpg.key' | apt-key add - \
|
|
&& echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-${LLVM_VERSION} main" > /etc/apt/sources.list.d/llvm.stable.list \
|
|
&& apt update \
|
|
&& apt install -y clang-${LLVM_VERSION} llvm-${LLVM_VERSION} \
|
|
&& bash -c 'for f in /usr/bin/clang*-${LLVM_VERSION} /usr/bin/llvm*-${LLVM_VERSION}; do ln -s "${f}" "${f%-${LLVM_VERSION}}"; done' \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
# PostgreSQL 14
|
|
RUN curl -fsSL 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' | apt-key add - \
|
|
&& echo 'deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
|
|
&& apt update \
|
|
&& apt install -y postgresql-client-14 \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
# AWS CLI
|
|
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" \
|
|
&& unzip -q awscliv2.zip \
|
|
&& ./aws/install \
|
|
&& rm awscliv2.zip
|
|
|
|
# Mold: A Modern Linker
|
|
ENV MOLD_VERSION v2.31.0
|
|
RUN set -e \
|
|
&& git clone https://github.com/rui314/mold.git \
|
|
&& mkdir mold/build \
|
|
&& cd mold/build \
|
|
&& git checkout ${MOLD_VERSION} \
|
|
&& cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ .. \
|
|
&& cmake --build . -j $(nproc) \
|
|
&& cmake --install . \
|
|
&& cd .. \
|
|
&& rm -rf mold
|
|
|
|
# LCOV
|
|
# Build lcov from a fork:
|
|
# It includes several bug fixes on top on v2.0 release (https://github.com/linux-test-project/lcov/compare/v2.0...master)
|
|
# And patches from us:
|
|
# - Generates json file with code coverage summary (https://github.com/neondatabase/lcov/commit/426e7e7a22f669da54278e9b55e6d8caabd00af0.tar.gz)
|
|
RUN for package in Capture::Tiny DateTime Devel::Cover Digest::MD5 File::Spec JSON::XS Memory::Process Time::HiRes JSON; do yes | perl -MCPAN -e "CPAN::Shell->notest('install', '$package')"; done \
|
|
&& wget https://github.com/neondatabase/lcov/archive/426e7e7a22f669da54278e9b55e6d8caabd00af0.tar.gz -O lcov.tar.gz \
|
|
&& echo "61a22a62e20908b8b9e27d890bd0ea31f567a7b9668065589266371dcbca0992 lcov.tar.gz" | sha256sum --check \
|
|
&& mkdir -p lcov && tar -xzf lcov.tar.gz -C lcov --strip-components=1 \
|
|
&& cd lcov \
|
|
&& make install \
|
|
&& rm -rf ../lcov.tar.gz
|
|
|
|
# Switch to nonroot user
|
|
USER nonroot:nonroot
|
|
WORKDIR /home/nonroot
|
|
|
|
# Python
|
|
ENV PYTHON_VERSION=3.9.18 \
|
|
PYENV_ROOT=/home/nonroot/.pyenv \
|
|
PATH=/home/nonroot/.pyenv/shims:/home/nonroot/.pyenv/bin:/home/nonroot/.poetry/bin:$PATH
|
|
RUN set -e \
|
|
&& cd $HOME \
|
|
&& curl -sSO https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer \
|
|
&& chmod +x pyenv-installer \
|
|
&& ./pyenv-installer \
|
|
&& export PYENV_ROOT=/home/nonroot/.pyenv \
|
|
&& export PATH="$PYENV_ROOT/bin:$PATH" \
|
|
&& export PATH="$PYENV_ROOT/shims:$PATH" \
|
|
&& pyenv install ${PYTHON_VERSION} \
|
|
&& pyenv global ${PYTHON_VERSION} \
|
|
&& python --version \
|
|
&& pip install --upgrade pip \
|
|
&& pip --version \
|
|
&& pip install pipenv wheel poetry
|
|
|
|
# Switch to nonroot user (again)
|
|
USER nonroot:nonroot
|
|
WORKDIR /home/nonroot
|
|
|
|
# Rust
|
|
# Please keep the version of llvm (installed above) in sync with rust llvm (`rustc --version --verbose | grep LLVM`)
|
|
ENV RUSTC_VERSION=1.78.0
|
|
ENV RUSTUP_HOME="/home/nonroot/.rustup"
|
|
ENV PATH="/home/nonroot/.cargo/bin:${PATH}"
|
|
RUN curl -sSO https://static.rust-lang.org/rustup/dist/$(uname -m)-unknown-linux-gnu/rustup-init && whoami && \
|
|
chmod +x rustup-init && \
|
|
./rustup-init -y --default-toolchain ${RUSTC_VERSION} && \
|
|
rm rustup-init && \
|
|
export PATH="$HOME/.cargo/bin:$PATH" && \
|
|
. "$HOME/.cargo/env" && \
|
|
cargo --version && rustup --version && \
|
|
rustup component add llvm-tools-preview rustfmt clippy && \
|
|
cargo install --git https://github.com/paritytech/cachepot && \
|
|
cargo install rustfilt && \
|
|
cargo install cargo-hakari && \
|
|
cargo install cargo-deny --locked && \
|
|
cargo install cargo-hack && \
|
|
cargo install cargo-nextest && \
|
|
rm -rf /home/nonroot/.cargo/registry && \
|
|
rm -rf /home/nonroot/.cargo/git
|
|
ENV RUSTC_WRAPPER=cachepot
|
|
|
|
# Show versions
|
|
RUN whoami \
|
|
&& python --version \
|
|
&& pip --version \
|
|
&& cargo --version --verbose \
|
|
&& rustup --version --verbose \
|
|
&& rustc --version --verbose \
|
|
&& clang --version
|