Skip to content

Commit d1aeefc

Browse files
authored
chore: Add ubi10 rust builder, update ubi9 rust builder (#1432)
* chore: Add ubi10 rust builder * chore(ubi-rust-builders): bump dependencies Note: Ignoring protoc (which could go to 34.0, but now it feels too close to the release time to update it). * chore: Update changelog * chore(ubi-rust-builders): Revert rustup update Note: The vesion from the changelog hasn't been tagged yet * chore(nix): Run niv update
1 parent 6133732 commit d1aeefc

8 files changed

Lines changed: 171 additions & 10 deletions

File tree

.github/ISSUE_TEMPLATE/update-base-ubi-rust-builders.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Add/Change/Remove anything that isn't applicable anymore
5252
> checked, the issue can be moved into _Development: Done_.
5353
5454
- [ ] Done for [ubi9-rust-builder/Dockerfile](https://github.com/stackabletech/docker-images/blob/main/ubi9-rust-builder/Dockerfile)
55+
- [ ] Done for [ubi10-rust-builder/Dockerfile](https://github.com/stackabletech/docker-images/blob/main/ubi10-rust-builder/Dockerfile)
5556
- [ ] Can build the image locally
5657
- [ ] Can build an operator image
5758

@@ -60,6 +61,7 @@ Add/Change/Remove anything that isn't applicable anymore
6061

6162
```shell
6263
docker build -t oci.stackable.tech/sdp/ubi9-rust-builder . -f ubi9-rust-builder/Dockerfile
64+
docker build -t oci.stackable.tech/sdp/ubi10-rust-builder . -f ubi10-rust-builder/Dockerfile
6365

6466
# Change directory into the an operator repository and ensure the image can build
6567
docker build . -f docker/Dockerfile

.github/workflows/ubi-rust-builder.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
fail-fast: false
2727
matrix:
2828
runner: ["ubuntu-latest", "ubicloud-standard-8-arm-ubuntu-2404"]
29-
ubi-version: ["ubi9"]
29+
ubi-version: ["ubi9", "ubi10"]
3030
steps:
3131
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3232
with:
@@ -75,7 +75,7 @@ jobs:
7575
strategy:
7676
fail-fast: false
7777
matrix:
78-
ubi-version: ["ubi9"]
78+
ubi-version: ["ubi9", "ubi10"]
7979
steps:
8080
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
8181
with:

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file.
2525
- spark: Add `3.5.8` ([#1414]).
2626
- spark-connect-client: Add `3.5.8` ([#1414]).
2727
- hbase: Backport HBASE-29797 to all HBAse versions (`2.6.3` and `2.6.4`) ([#1425]).
28+
- ubi10-rust-builder: Add new ubi10 base image for operators to begin using ([#1432]).
2829

2930
### Changed
3031

@@ -43,6 +44,7 @@ All notable changes to this project will be documented in this file.
4344
Pull logging dependencies with `mvn` instead of `curl` to remove manual maintenance in Nexus `packages`.
4445
- hbase: Update `hbase-operator-tools` from `1.3.0-fd5a5fb` to `1.3.0` ([#1425]).
4546
- nifi: Backported NiFi-15567 to NiFi 2.6.0 and 2.7.2 to fix CVE CVE-2026-25903 ([#1429]).
47+
- ubi9-rust-builder: Bump rust toolchain and cargo auditable versions ([#1432]).
4648

4749
### Removed
4850

@@ -106,6 +108,7 @@ All notable changes to this project will be documented in this file.
106108
[#1426]: https://github.com/stackabletech/docker-images/pull/1426
107109
[#1428]: https://github.com/stackabletech/docker-images/pull/1428
108110
[#1429]: https://github.com/stackabletech/docker-images/pull/1429
111+
[#1432]: https://github.com/stackabletech/docker-images/pull/1432
109112

110113
## [25.11.0] - 2025-11-07
111114

nix/sources.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ubi10-rust-builder/Dockerfile

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# syntax=docker/dockerfile:1.16.0@sha256:e2dd261f92e4b763d789984f6eab84be66ab4f5f08052316d8eb8f173593acf7
2+
# check=error=true
3+
4+
# Find the latest version at https://catalog.redhat.com/en/software/containers/ubi10/ubi-minimal/66f1504a379b9c2cf23e145c#get-the-image
5+
# IMPORTANT: Make sure to use the "Manifest List Digest" that references the images for multiple architectures
6+
# rather than just the "Image Digest" that references the image for the selected architecture.
7+
# The website is broken, so you can use this to find it:
8+
# curl https://catalog.redhat.com/en/software/containers/ubi10/ubi-minimal/66f1504a379b9c2cf23e145c \
9+
# | grep -oE 'registry.redhat.io/ubi10/ubi-minimal@sha256:[a-z0-9]{64}'
10+
FROM registry.access.redhat.com/ubi10/ubi-minimal@sha256:a74a7a92d3069bfac09c6882087771fc7db59fa9d8e16f14f4e012fe7288554c AS builder
11+
12+
LABEL maintainer="Stackable GmbH"
13+
14+
# Pin the rustup version to avoid unexpected breaking changes.
15+
# See https://github.com/rust-lang/rustup/blob/4514d36fcc9c42416176111cd841c86f7ec44b2c/rustup-init.sh#L91
16+
# Find the latest version here: https://github.com/rust-lang/rustup/tags
17+
# renovate: datasource=github-tags packageName=rust-lang/rustup
18+
ENV RUSTUP_VERSION=1.28.2
19+
# This SHOULD be kept in sync with operator-templating and other tools to reduce build times
20+
# Find the latest version here: https://doc.rust-lang.org/stable/releases.html
21+
# renovate: datasource=github-releases packageName=rust-lang/rust
22+
ENV RUST_DEFAULT_TOOLCHAIN_VERSION=1.93.0
23+
# Find the latest version here: https://crates.io/crates/cargo-cyclonedx
24+
# renovate: datasource=crate packageName=cargo-cyclonedx
25+
ENV CARGO_CYCLONEDX_CRATE_VERSION=0.5.7
26+
# Find the latest version here: https://crates.io/crates/cargo-auditable
27+
# renovate: datasource=crate packageName=cargo-auditable
28+
ENV CARGO_AUDITABLE_CRATE_VERSION=0.7.2
29+
# Find the latest version here: https://github.com/protocolbuffers/protobuf/releases
30+
# Upload any newer version to nexus with ./.scripts/upload_new_protoc_version.sh
31+
# renovate: datasource=github-releases packageName=protocolbuffers/protobuf
32+
ENV PROTOC_VERSION=31.1
33+
34+
# Sets the default shell to Bash with strict error handling and robust pipeline processing.
35+
# "-e": Exits immediately if a command exits with a non-zero status
36+
# "-u": Treats unset variables as an error, preventing unexpected behavior from undefined variables.
37+
# "-o pipefail": Causes a pipeline to return the exit status of the last command in the pipe that failed, ensuring errors in any part of a pipeline are not ignored.
38+
# "-c": Allows the execution of commands passed as a string
39+
# This is automatically inherited in all other Dockerfiles that use this unless it is overwritten
40+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
41+
42+
# We configure microdnf to not install weak dependencies in this file
43+
# Not doing this caused the content of images to become unpredictable because
44+
# based on which packages get updated by `microdnf update` new weak dependencies
45+
# might be installed that were not present earlier (the ubi base image doesn't
46+
# seem to install weak dependencies)
47+
# This also affects the packages that are installed in our Dockerfiles (java as prime
48+
# example).
49+
# https://github.com/stackabletech/docker-images/pull/533
50+
COPY stackable-base/stackable/dnf.conf /etc/dnf/dnf.conf
51+
52+
# Update image and install everything needed for Rustup & Rust
53+
RUN microdnf update \
54+
&& microdnf install \
55+
clang \
56+
cmake \
57+
curl-minimal \
58+
findutils \
59+
gcc \
60+
gcc-c++ \
61+
# krb5 needed for secret-operator
62+
krb5-devel \
63+
krb5-libs \
64+
libkadm5 \
65+
make \
66+
openssl-devel \
67+
pkg-config \
68+
systemd-devel \
69+
# tar needed to create the source code snapshot before building the Rust code
70+
tar \
71+
unzip \
72+
&& microdnf clean all \
73+
&& rm -rf /var/cache/yum
74+
75+
# Container Storage Interface is defined using GRPC/Protobuf, our operators that use it (secret-operator/listener-operator) require
76+
# protoc via Prost (https://github.com/tokio-rs/prost).
77+
WORKDIR /opt/protoc
78+
# Prost does not document which version of protoc it expects (https://docs.rs/prost-build/0.12.4/prost_build/), so this should be the latest upstream version
79+
# (within reason).
80+
RUN ARCH=$(arch | sed 's/^aarch64$/aarch_64/') \
81+
&& curl --fail --location --output protoc.zip "https://repo.stackable.tech/repository/packages/protoc/protoc-${PROTOC_VERSION}-linux-${ARCH}.zip" \
82+
&& unzip protoc.zip \
83+
&& rm protoc.zip
84+
ENV PROTOC=/opt/protoc/bin/protoc
85+
WORKDIR /
86+
87+
# IMPORTANT
88+
# If you change the toolchain version here, make sure to also change the "rust_version"
89+
# property in operator-templating/config/rust.yaml
90+
RUN <<EOF
91+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | RUSTUP_VERSION="$RUSTUP_VERSION" sh -s -- -y --default-toolchain "$RUST_DEFAULT_TOOLCHAIN_VERSION"
92+
. "$HOME/.cargo/env"
93+
cargo install --quiet --locked "cargo-cyclonedx@$CARGO_CYCLONEDX_CRATE_VERSION" "cargo-auditable@$CARGO_AUDITABLE_CRATE_VERSION"
94+
EOF
95+
96+
# Build artifacts will be available in /app.
97+
RUN mkdir /app
98+
99+
COPY shared/copy_artifacts.sh /
100+
101+
ONBUILD WORKDIR /src
102+
ONBUILD COPY . /src
103+
104+
ONBUILD RUN <<EOF
105+
. "$HOME/.cargo/env"
106+
tar -czf /app/stackable-src.tar.gz .
107+
cargo auditable --quiet build --release --workspace
108+
cargo cyclonedx --all --spec-version 1.5 --describe binaries
109+
110+
# -maxdepth 1: The interesting binaries are all directly in ${BUILD_DIR}.
111+
# -regex filters out tests
112+
# - exec copies matching files to /app
113+
find /src/target/release \
114+
-regextype egrep \
115+
-maxdepth 1 \
116+
-executable \
117+
-type f \
118+
! -regex ".*\-[a-fA-F0-9]{16,16}$" \
119+
-exec /copy_artifacts.sh {} \;
120+
121+
echo "The following files will be copied to the runtime image: $(ls /app)"
122+
EOF

ubi10-rust-builder/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# ubi10-rust-builder
2+
3+
These images are meant to be used in multi-stage builds as a base image for projects building Rust projects.
4+
They are automatically rebuilt and pushed every night and also on every push to the main branch, in addition a build can be triggered using GitHub Actions.
5+
6+
The image will run `cargo build --release` in the current context and copy all binaries to an `/app` directory.
7+
8+
This will bake in the current stable Rust version at the time this image was built, which means it should be rebuilt (and tagged) for every release of Rust.
9+
10+
## Example usage
11+
12+
```dockerfile
13+
FROM oci.stackable.tech/sdp/ubi10-rust-builder AS builder
14+
15+
FROM registry.access.redhat.com/ubi10/ubi-minimal AS operator
16+
LABEL maintainer="Stackable GmbH"
17+
18+
# Update image
19+
RUN microdnf update \
20+
&& microdnf install \
21+
shadow-utils \
22+
&& rm -rf /var/cache/yum
23+
24+
COPY --from=builder /app/stackable-zookeeper-operator /
25+
26+
RUN groupadd -g 1000 stackable && adduser -u 1000 -g stackable -c 'Stackable Operator' stackable
27+
28+
USER 1000:1000
29+
30+
ENTRYPOINT ["/stackable-zookeeper-operator"]
31+
```

ubi9-rust-builder/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,28 @@
33

44
# Find the latest version at https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5?container-tabs=gti
55
# IMPORTANT: Be sure to use the Manifest List Digest for multi-arch support
6-
FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:bb08f2300cb8d12a7eb91dddf28ea63692b3ec99e7f0fa71a1b300f2756ea829 AS builder
6+
# The website is broken, so you can use this to find it:
7+
# curl https://catalog.redhat.com/en/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5 \
8+
# | grep -oE 'registry.redhat.io/ubi9/ubi-minimal@sha256:[a-z0-9]{64}'
9+
FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:c7d44146f826037f6873d99da479299b889473492d3c1ab8af86f08af04ec8a0 AS builder
710

811
LABEL maintainer="Stackable GmbH"
912

1013
# Pin the rustup version to avoid unexpected breaking changes.
1114
# See https://github.com/rust-lang/rustup/blob/4514d36fcc9c42416176111cd841c86f7ec44b2c/rustup-init.sh#L91
12-
# Find the latest version here: https://github.com/rust-lang/rustup/blob/master/CHANGELOG.md
15+
# Find the latest version here: https://github.com/rust-lang/rustup/tags
1316
# renovate: datasource=github-tags packageName=rust-lang/rustup
1417
ENV RUSTUP_VERSION=1.28.2
1518
# This SHOULD be kept in sync with operator-templating and other tools to reduce build times
1619
# Find the latest version here: https://doc.rust-lang.org/stable/releases.html
1720
# renovate: datasource=github-releases packageName=rust-lang/rust
18-
ENV RUST_DEFAULT_TOOLCHAIN_VERSION=1.89.0
21+
ENV RUST_DEFAULT_TOOLCHAIN_VERSION=1.93.0
1922
# Find the latest version here: https://crates.io/crates/cargo-cyclonedx
2023
# renovate: datasource=crate packageName=cargo-cyclonedx
2124
ENV CARGO_CYCLONEDX_CRATE_VERSION=0.5.7
2225
# Find the latest version here: https://crates.io/crates/cargo-auditable
2326
# renovate: datasource=crate packageName=cargo-auditable
24-
ENV CARGO_AUDITABLE_CRATE_VERSION=0.7.1
27+
ENV CARGO_AUDITABLE_CRATE_VERSION=0.7.2
2528
# Find the latest version here: https://github.com/protocolbuffers/protobuf/releases
2629
# Upload any newer version to nexus with ./.scripts/upload_new_protoc_version.sh
2730
# renovate: datasource=github-releases packageName=protocolbuffers/protobuf

ubi9-rust-builder/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This will bake in the current stable Rust version at the time this image was bui
1010
## Example usage
1111

1212
```dockerfile
13-
FROM oci.stackable.tech/ubi9-rust-builder AS builder
13+
FROM oci.stackable.tech/sdp/ubi9-rust-builder AS builder
1414

1515
FROM registry.access.redhat.com/ubi9/ubi-minimal AS operator
1616
LABEL maintainer="Stackable GmbH"

0 commit comments

Comments
 (0)