Files
source-stack/rocky9-system/Dockerfile
T
GuofangandClaude Sonnet 5.5 464bf717ed Build Protobuf from source in rocky9-system
Every other library still comes from the distribution packages.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 11:25:58 +08:00

111 lines
3.3 KiB
Docker

FROM docker.io/library/rockylinux:9
# Toolchain and build tools, same as the rocky9 image.
RUN dnf install --assumeyes --enablerepo=crb \
autoconf \
automake \
bzip2 \
ca-certificates \
cmake \
curl-minimal \
gcc \
gcc-c++ \
libasan \
gcc-toolset-15-gcc-c++ \
gcc-toolset-15-libasan-devel \
git \
libtool \
make \
ninja-build \
patch \
perl-core \
pkgconf-pkg-config \
rpm-build \
tar \
xz \
which \
epel-release \
&& sed \
-e 's!^metalink=!#metalink=!g' \
-e 's!^#baseurl=!baseurl=!g' \
-e 's!https\?://download\.example/pub/epel!https://mirrors.ustc.edu.cn/epel!g' \
-i /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing.repo \
&& dnf install --assumeyes \
makeself \
&& dnf upgrade --assumeyes \
&& dnf clean all \
&& rm -rf /var/cache/dnf
RUN git config --global url."https://wangguofang.net/github.com/".insteadOf "https://github.com/"
RUN test "$(cmake --version | sed -n '1s/[^0-9]*//p' | cut -d. -f2)" -ge 29
# Libraries come from the distribution (Rocky Linux 9, CRB and EPEL) instead of being built from
# source, except Protobuf (below). A package that is not available in these repositories is skipped, not an error.
RUN dnf install --assumeyes --enablerepo=crb,epel \
--setopt=skip_missing_names_on_install=True \
--skip-broken \
boost-devel \
cyrus-sasl-devel \
fast_float-devel \
fmt-devel \
folly-devel \
gflags-devel \
glog-devel \
gmock-devel \
gmp-devel \
gnutls-devel \
gtest-devel \
hiredis-devel \
jsoncpp-devel \
json-c-devel \
libaio-devel \
libcurl-devel \
libdwarf-devel \
libevent-devel \
libmaxminddb-devel \
libsodium-devel \
liburing-devel \
libuuid-devel \
libxml2-devel \
libyaml-devel \
libzstd-devel \
log4cplus-devel \
lz4-devel \
magic_enum-devel \
nettle-devel \
numactl-devel \
openssl-devel \
rapidjson-devel \
librdkafka-devel \
snappy-devel \
spdlog-devel \
thrift-devel \
tsl-sparse-map-devel \
xsimd-devel \
xxhash-devel \
zeromq-devel \
czmq-devel \
zlib-devel \
libarrow-devel \
parquet-libs-devel \
&& dnf clean all \
&& rm -rf /var/cache/dnf
# Protobuf is the only library built from source; it is installed under /usr/local, which takes
# precedence over the system packages in /usr.
RUN --mount=type=bind,from=sources,source=protobuf-v3.21.12.tar.gz,target=/tmp/protobuf.tar.gz \
mkdir src \
&& tar --extract --gzip --file=/tmp/protobuf.tar.gz --directory=src --strip-components=1 \
&& cmake -G Ninja -S src -B build -Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_SHARED_LIBS=OFF \
-Dprotobuf_WITH_ZLIB=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
&& cmake --build build --parallel "$(nproc)" --target install \
&& rm -rf build src
CMD ["/bin/bash"]