Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
# fully endorsed by the ASF.

ARG RUST_VERSION=1.96

FROM rust:${RUST_VERSION}-slim-bookworm AS builder
FROM rust:${RUST_VERSION}-slim-trixie AS builder

WORKDIR /build
RUN apt-get update && apt-get install -y \
Expand All @@ -46,7 +45,7 @@ RUN npm --prefix web ci && npm --prefix web run build:static
RUN cargo build --bin iggy --release
RUN cargo build --bin iggy-server --release

FROM debian:bookworm-slim
FROM debian:trixie-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
liblzma5 \
Expand Down
5 changes: 3 additions & 2 deletions bdd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
# or stability of the code, it does indicate that the project has yet to be
# fully endorsed by the ASF.

FROM rust:1.96.0-alpine3.22 AS builder
ARG RUST_VERSION=1.96
FROM rust:${RUST_VERSION}-slim-trixie AS builder
RUN apk add musl-dev

WORKDIR /app
Expand All @@ -36,7 +37,7 @@ COPY . .
# Build server in debug mode for faster compilation
RUN cargo build --bin iggy-server

FROM debian:bookworm-slim
FROM debian:trixie-slim

# Install curl for healthcheck
RUN apt-get update && \
Expand Down
3 changes: 0 additions & 3 deletions bdd/java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
# or stability of the code, it does indicate that the project has yet to be
# fully endorsed by the ASF.

ARG RUST_VERSION=1.96
FROM rust:${RUST_VERSION}

FROM gradle:9.6.0-jdk17

WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion bdd/rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# fully endorsed by the ASF.

ARG RUST_VERSION=1.96
FROM rust:${RUST_VERSION}
FROM rust:${RUST_VERSION}-slim-trixie

WORKDIR /app

Expand Down
1 change: 0 additions & 1 deletion core/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

ARG RUST_VERSION=1.96
ARG ALPINE_VERSION=3.23

# ── from-source path ─────────────────────────────────────────────────────────
FROM --platform=$BUILDPLATFORM lukemathwalker/cargo-chef:latest-rust-${RUST_VERSION}-alpine${ALPINE_VERSION} AS chef
WORKDIR /app
Expand Down
3 changes: 2 additions & 1 deletion foreign/php/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.

FROM rust:1.96-slim-bookworm
ARG RUST_VERSION=1.96
FROM rust:${RUST_VERSION}-slim-trixie

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
Expand Down
2 changes: 1 addition & 1 deletion foreign/python/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# or stability of the code, it does indicate that the project has yet to be
# fully endorsed by the ASF.

FROM mcr.microsoft.com/devcontainers/python:1-3.10-bullseye
FROM mcr.microsoft.com/devcontainers/python:1-3.10-trixie

ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
Expand Down
2 changes: 1 addition & 1 deletion foreign/python/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# or stability of the code, it does indicate that the project has yet to be
# fully endorsed by the ASF.
# Multi-stage build for Python SDK testing
FROM python:3.10-slim AS base
FROM python:3.10-slim-trixie AS base

# Install system dependencies
RUN apt-get update && apt-get install -y \
Expand Down
8 changes: 4 additions & 4 deletions scripts/ci/sync-python-interpreter-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,15 @@ ensure_classifiers "$SOURCE_FILE"

ensure_line \
"foreign/python/Dockerfile.test" \
"^(FROM python:)[0-9]+\\.[0-9]+(-slim AS base)$" \
"^FROM python:${PYTHON_VERSION_REGEX}-slim AS base$" \
"^(FROM python:)[0-9]+\\.[0-9]+(-slim-trixie AS base)$" \
"^FROM python:${PYTHON_VERSION_REGEX}-slim-trixie AS base$" \
"\\1${PYTHON_VERSION}\\2" \
"Docker image Python version"

ensure_line \
"foreign/python/.devcontainer/Dockerfile" \
"^(FROM mcr\\.microsoft\\.com/devcontainers/python:1-)[0-9]+\\.[0-9]+(-bullseye)$" \
"^FROM mcr\\.microsoft\\.com/devcontainers/python:1-${PYTHON_VERSION_REGEX}-bullseye$" \
"^(FROM mcr\\.microsoft\\.com/devcontainers/python:1-)[0-9]+\\.[0-9]+(-trixie)$" \
"^FROM mcr\\.microsoft\\.com/devcontainers/python:1-${PYTHON_VERSION_REGEX}-trixie$" \
"\\1${PYTHON_VERSION}\\2" \
"devcontainer Python image version"

Expand Down
66 changes: 56 additions & 10 deletions scripts/ci/sync-rustc-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ fi

# Strip trailing ".0" -> e.g., 1.89.0 -> 1.89 (no change if it doesn't end in .0)
RUST_VERSION_SHORT=$(echo "$RUST_VERSION" | sed -E 's/^([0-9]+)\.([0-9]+)\.0$/\1.\2/')
RUST_IMAGE_VARIANT="slim-trixie"
RUST_IMAGE_PATTERN="FROM[[:space:]].*\\brust:"
RUST_IMAGE_TAG_PATTERN="(rust:[^-[:space:]]+)"

echo "Rust version from rust-toolchain.toml: ${GREEN}$RUST_VERSION${NC} (using ${GREEN}$RUST_VERSION_SHORT${NC} for Dockerfiles)"
echo ""
Expand All @@ -91,6 +94,12 @@ TOTAL_FILES=0
FIXED_FILES=0

for dockerfile in $DOCKERFILES; do
SOURCE=""
CURRENT_VERSION=""
EXPECTED_VERSION=""
HAS_RUST_IMAGE="false"
RUST_IMAGE_MISMATCH="false"

# Two ways a Dockerfile pins the toolchain:
# 1. `ARG RUST_VERSION=1.96` (+ `FROM rust:${RUST_VERSION}...`)
# 2. hardcoded `FROM rust:1.96-slim` / `FROM rust:1.96.0-alpine`
Expand All @@ -108,30 +117,67 @@ for dockerfile in $DOCKERFILES; do
else
EXPECTED_VERSION="$RUST_VERSION_SHORT"
fi
else
fi

if grep -qE "$RUST_IMAGE_PATTERN" "$dockerfile" 2>/dev/null; then
HAS_RUST_IMAGE="true"
if grep -E "$RUST_IMAGE_PATTERN" "$dockerfile" | grep -qvE -- "-$RUST_IMAGE_VARIANT([[:space:]]|$)"; then
RUST_IMAGE_MISMATCH="true"
fi
fi

if [ -z "$SOURCE" ] && [ "$HAS_RUST_IMAGE" = "false" ]; then
continue
fi

TOTAL_FILES=$((TOTAL_FILES + 1))
STATUS_DETAILS="$CURRENT_VERSION"
if [ "$HAS_RUST_IMAGE" = "true" ]; then
STATUS_DETAILS="${STATUS_DETAILS:+$STATUS_DETAILS, }$RUST_IMAGE_VARIANT"
fi

if [ "$MODE" = "check" ]; then
if [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ]; then
if { [ -n "$SOURCE" ] && [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ]; } || [ "$RUST_IMAGE_MISMATCH" = "true" ]; then
MISALIGNED_FILES+=("$dockerfile")
echo -e "${RED}✗${NC} $dockerfile: ${RED}$CURRENT_VERSION${NC} (expected: ${GREEN}$EXPECTED_VERSION${NC})"
MESSAGE=""
if [ -n "$SOURCE" ] && [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ]; then
MESSAGE="Rust version ${RED}$CURRENT_VERSION${NC} (expected: ${GREEN}$EXPECTED_VERSION${NC})"
fi
if [ "$RUST_IMAGE_MISMATCH" = "true" ]; then
if [ -n "$MESSAGE" ]; then
MESSAGE="$MESSAGE; "
fi
MESSAGE="${MESSAGE}Rust base image must use ${GREEN}$RUST_IMAGE_VARIANT${NC}"
fi
echo -e "${RED}✗${NC} $dockerfile: $MESSAGE"
else
echo -e "${GREEN}✓${NC} $dockerfile: $CURRENT_VERSION"
echo -e "${GREEN}✓${NC} $dockerfile${STATUS_DETAILS:+: $STATUS_DETAILS}"
fi
elif [ "$MODE" = "fix" ]; then
if [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ]; then
if [ "$SOURCE" = "arg" ]; then
if { [ -n "$SOURCE" ] && [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ]; } || [ "$RUST_IMAGE_MISMATCH" = "true" ]; then
if [ -n "$SOURCE" ] && [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ] && [ "$SOURCE" = "arg" ]; then
sed -i "s/^ARG RUST_VERSION=.*/ARG RUST_VERSION=$EXPECTED_VERSION/" "$dockerfile"
else
sed -i -E "s/(\brust:)[0-9]+\.[0-9]+(\.[0-9]+)?/\1$EXPECTED_VERSION/g" "$dockerfile"
elif [ -n "$SOURCE" ] && [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ]; then
sed -i -E "/FROM[[:space:]].*\\brust:[0-9]/ s#(\\brust:)[0-9]+\\.[0-9]+(\\.[0-9]+)?#\\1$EXPECTED_VERSION#g" "$dockerfile"
fi
if [ "$RUST_IMAGE_MISMATCH" = "true" ]; then
sed -i -E "/$RUST_IMAGE_PATTERN/ s#$RUST_IMAGE_TAG_PATTERN-[^[:space:]]+#\\1-$RUST_IMAGE_VARIANT#g" "$dockerfile"
sed -i -E "/$RUST_IMAGE_PATTERN/ { /-$RUST_IMAGE_VARIANT([[:space:]]|$)/! s#$RUST_IMAGE_TAG_PATTERN([[:space:]]|$)#\\1-$RUST_IMAGE_VARIANT\\2#g; }" "$dockerfile"
fi
FIXED_FILES=$((FIXED_FILES + 1))
echo -e "${GREEN}Fixed${NC} $dockerfile: ${RED}$CURRENT_VERSION${NC} -> ${GREEN}$EXPECTED_VERSION${NC}"
MESSAGE=""
if [ -n "$SOURCE" ] && [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ]; then
MESSAGE="Rust version ${RED}$CURRENT_VERSION${NC} -> ${GREEN}$EXPECTED_VERSION${NC}"
fi
if [ "$RUST_IMAGE_MISMATCH" = "true" ]; then
if [ -n "$MESSAGE" ]; then
MESSAGE="$MESSAGE; "
fi
MESSAGE="${MESSAGE}Rust base image -> ${GREEN}$RUST_IMAGE_VARIANT${NC}"
fi
echo -e "${GREEN}Fixed${NC} $dockerfile: $MESSAGE"
else
echo -e "${GREEN}✓${NC} $dockerfile: already correct ($CURRENT_VERSION)"
echo -e "${GREEN}✓${NC} $dockerfile${STATUS_DETAILS:+: already correct ($STATUS_DETAILS)}"
fi
fi
done
Expand Down
Loading