-
Notifications
You must be signed in to change notification settings - Fork 1.8k
packaging: add debian trixie support #10728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,56 @@ | |
|
||
ENV PATH="${CMAKE_HOME}/bin:${PATH}" | ||
|
||
# debian/trixie base image | ||
FROM debian:trixie-slim AS debian-trixie-base | ||
ENV DEBIAN_FRONTEND="noninteractive" \ | ||
CMAKE_HOME="/opt/cmake" | ||
|
||
ARG CMAKE_VERSION="3.31.6" | ||
ARG CMAKE_URL="https://github.com/Kitware/CMake/releases/download" | ||
|
||
# hadolint ignore=DL3008,DL3015 | ||
RUN apt-get -qq update && \ | ||
Check warning on line 181 in packaging/distros/debian/Dockerfile
|
||
apt-get install -y curl ca-certificates build-essential \ | ||
make bash sudo wget unzip dh-make \ | ||
libsystemd-dev zlib1g-dev flex bison \ | ||
libssl3 libssl-dev libpq-dev postgresql-server-dev-all \ | ||
libsasl2-2 libsasl2-dev libyaml-dev libcurl4-openssl-dev pkg-config \ | ||
tar gzip && \ | ||
apt-get install -y --reinstall lsb-base lsb-release && \ | ||
mkdir -p "${CMAKE_HOME}" && \ | ||
cmake_download_url="${CMAKE_URL}/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz" && \ | ||
echo "Downloading CMake ${CMAKE_VERSION}: ${cmake_download_url} -> ${CMAKE_HOME}" && \ | ||
curl -jksSL "${cmake_download_url}" | tar -xzf - -C "${CMAKE_HOME}" --strip-components 1 | ||
|
||
ENV PATH="${CMAKE_HOME}/bin:${PATH}" | ||
|
||
# debian/trixie.arm64v8 base image | ||
FROM arm64v8/debian:trixie-slim AS debian-trixie.arm64v8-base | ||
ENV DEBIAN_FRONTEND="noninteractive" \ | ||
CMAKE_HOME="/opt/cmake" | ||
|
||
COPY --from=multiarch-aarch64 /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static | ||
|
||
ARG CMAKE_VERSION="3.31.6" | ||
ARG CMAKE_URL="https://github.com/Kitware/CMake/releases/download" | ||
|
||
# hadolint ignore=DL3008,DL3015 | ||
RUN apt-get -qq update && \ | ||
Check warning on line 207 in packaging/distros/debian/Dockerfile
|
||
apt-get install -y curl ca-certificates build-essential \ | ||
make bash sudo wget unzip dh-make \ | ||
libsystemd-dev zlib1g-dev flex bison \ | ||
libssl3 libssl-dev libpq-dev postgresql-server-dev-all \ | ||
libsasl2-2 libsasl2-dev libyaml-dev libcurl4-openssl-dev pkg-config \ | ||
tar gzip && \ | ||
apt-get install -y --reinstall lsb-base lsb-release && \ | ||
mkdir -p "${CMAKE_HOME}" && \ | ||
cmake_download_url="${CMAKE_URL}/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz" && \ | ||
echo "Downloading CMake ${CMAKE_VERSION}: ${cmake_download_url} -> ${CMAKE_HOME}" && \ | ||
curl -jksSL "${cmake_download_url}" | tar -xzf - -C "${CMAKE_HOME}" --strip-components 1 | ||
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ENV PATH="${CMAKE_HOME}/bin:${PATH}" | ||
|
||
# Common build for all distributions now | ||
# hadolint ignore=DL3006 | ||
FROM $BASE_BUILDER AS builder | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# For staging upgrade we use the 'official-install' as the base | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Staging upgrade path is not exercised; wire the final stage to the prepared official base Comment says upgrade uses official-install, but staging-upgrade is FROM staging-install. Start staging-upgrade FROM staging-upgrade-prep and perform the repo/key setup + upgrade there so we actually test “official → staging” on the same OS image. -FROM staging-install as staging-upgrade
+FROM staging-upgrade-prep as staging-upgrade
+ARG STAGING_VERSION
+ARG STAGING_URL
+ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
+ENV FLUENT_BIT_PACKAGES_KEY=${FLUENT_BIT_PACKAGES_URL}/fluentbit.key
+SHELL ["/bin/bash", "-o", "pipefail", "-c"]
+# Prepare keyring and staging repo, then upgrade
+RUN apt-get update && apt-get install -y ca-certificates curl gnupg
+RUN install -m 0755 -d /etc/apt/keyrings \
+ && curl -fsSL "$FLUENT_BIT_PACKAGES_KEY" | gpg --dearmor -o /etc/apt/keyrings/fluent-bit-archive-keyring.gpg
+RUN . /etc/os-release && echo "deb [signed-by=/etc/apt/keyrings/fluent-bit-archive-keyring.gpg] $FLUENT_BIT_PACKAGES_URL/debian/$VERSION_CODENAME $VERSION_CODENAME main" > /etc/apt/sources.list.d/fluent-bit.list
+# hadolint ignore=DL3015,DL3008,DL3009
+RUN apt-get update && if [ -n "${STAGING_VERSION:-}" ]; then apt-get install -y "fluent-bit=${STAGING_VERSION}"; else apt-get install -y fluent-bit; fi \
+ && rm -rf /var/lib/apt/lists/*
+RUN systemctl enable fluent-bit
+COPY ./test.sh /test.sh
+RUN chmod a+x /test.sh Also applies to: 23-25, 47-48 🤖 Prompt for AI Agents
|
||
ARG STAGING_BASE=docker.io/dokken/debian-13 | ||
|
||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainStaging “upgrade” flow doesn’t use the official-installed base; orphan stage and comment mismatch
Fix by basing -FROM ${STAGING_BASE} as staging-install
+FROM ${STAGING_BASE} as staging-install
@@
-FROM staging-install as staging-upgrade
+FROM staging-upgrade-prep as staging-upgrade
+ARG STAGING_VERSION
+ARG STAGING_URL
+ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
+ENV FLUENT_BIT_PACKAGES_KEY=${FLUENT_BIT_PACKAGES_URL}/fluentbit.key
+SHELL ["/bin/bash", "-o", "pipefail", "-c"]
+# Prepare keyring and staging repo, then upgrade
+RUN apt-get update && apt-get install -y ca-certificates curl gnupg
+RUN install -m 0755 -d /etc/apt/keyrings \
+ && curl -fsSL "$FLUENT_BIT_PACKAGES_KEY" | gpg --dearmor -o /etc/apt/keyrings/fluent-bit-archive-keyring.gpg
+RUN . /etc/os-release && echo "deb [signed-by=/etc/apt/keyrings/fluent-bit-archive-keyring.gpg] $FLUENT_BIT_PACKAGES_URL/debian/$VERSION_CODENAME $VERSION_CODENAME main" > /etc/apt/sources.list.d/fluent-bit.list
+RUN apt-get update && apt-get install -y fluent-bit && rm -rf /var/lib/apt/lists/*
+RUN systemctl enable fluent-bit
+COPY ./test.sh /test.sh
+RUN chmod a+x /test.sh This makes the upgrade stage actually exercise an upgrade from the official install to the staging repository on the same OS image. Also applies to: 23-27, 47-48 🏁 Script executed: #!/bin/bash
set -euo pipefail
file="packaging/testing/smoke/packages/Dockerfile.debian13"
if [[ ! -f "$file" ]]; then
echo "ERROR: File not found: $file" >&2
exit 2
fi
echo "=== File: $file ==="
awk '{printf "%4d: %s\n", NR, $0}' "$file"
echo
echo "=== Grep for relevant patterns ==="
grep -n -E 'staging-upgrade|staging-upgrade-prep|staging-install|STAGING_BASE|official-install|fluent-bit|staging-upgrade-prep' "$file" || true Length of output: 2897 Staging upgrade stage doesn't use the prepared official-install base (staging-upgrade-prep) The Dockerfile defines a prep stage that removes the official apt source but the Affected locations:
Suggested minimal fix (replace the final stage and re-add staging repo/key + install to actually perform the upgrade): -FROM staging-install as staging-upgrade
+FROM staging-upgrade-prep as staging-upgrade
+ARG STAGING_VERSION
+ARG STAGING_URL
+ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
+ARG STAGING_KEY=${STAGING_URL}/fluentbit.key
+ENV FLUENT_BIT_PACKAGES_KEY=${STAGING_KEY}
+SHELL ["/bin/bash", "-o", "pipefail", "-c"]
+# re-add staging key/repo and upgrade
+RUN wget -qO - $FLUENT_BIT_PACKAGES_KEY | apt-key add - \
+ && echo "deb $FLUENT_BIT_PACKAGES_URL/debian/bookworm bookworm main" >> /etc/apt/sources.list \
+ && apt-get update && apt-get install -y fluent-bit \
+ && systemctl enable fluent-bit \
+ && rm -rf /var/lib/apt/lists/*
+COPY ./test.sh /test.sh
+RUN chmod a+x /test.sh This ensures the upgrade stage starts from the image with the official install, then re-adds the staging repository and actually performs the upgrade.
🤖 Prompt for AI Agents
|
||
ARG RELEASE_URL=https://packages.fluentbit.io | ||
ARG RELEASE_KEY=https://packages.fluentbit.io/fluentbit.key | ||
|
||
# hadolint ignore=DL3006 | ||
FROM docker.io/dokken/debian-13 as official-install | ||
|
||
ARG RELEASE_URL | ||
ENV FLUENT_BIT_PACKAGES_URL=${RELEASE_URL} | ||
|
||
ARG RELEASE_KEY | ||
ENV FLUENT_BIT_PACKAGES_KEY=${RELEASE_KEY} | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh | ||
RUN systemctl enable fluent-bit | ||
|
||
COPY ./test.sh /test.sh | ||
RUN chmod a+x /test.sh | ||
|
||
FROM official-install as staging-upgrade-prep | ||
RUN rm -f /etc/apt/sources.list.d/fluent-bit.list | ||
|
||
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Keep apt source path consistent (.list.d vs sources.list)
This is addressed in the dynamic-codename change; if you don’t adopt that, at least change Line 39 to: -RUN echo "deb $FLUENT_BIT_PACKAGES_URL/debian/bookworm bookworm main" >> /etc/apt/sources.list
+RUN echo "deb $FLUENT_BIT_PACKAGES_URL/debian/trixie trixie main" > /etc/apt/sources.list.d/fluent-bit.list Also applies to: 39-39 🤖 Prompt for AI Agents
|
||
# hadolint ignore=DL3006 | ||
FROM ${STAGING_BASE} as staging-install | ||
ARG STAGING_VERSION | ||
ENV STAGING_VERSION=${STAGING_VERSION} | ||
|
||
ARG STAGING_URL | ||
ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL} | ||
|
||
ARG STAGING_KEY=${STAGING_URL}/fluentbit.key | ||
ENV FLUENT_BIT_PACKAGES_KEY=${STAGING_KEY} | ||
|
||
Comment on lines
+31
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainFix ARG default referencing another ARG; derive key URL from the resolved repo URL
ARG STAGING_URL
ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
-ARG STAGING_KEY=${STAGING_URL}/fluentbit.key
-ENV FLUENT_BIT_PACKAGES_KEY=${STAGING_KEY}
+ENV FLUENT_BIT_PACKAGES_KEY=${FLUENT_BIT_PACKAGES_URL}/fluentbit.key If you need to override the key independently, consider adding an optional build arg and a RUN pre-step to override it safely: ARG FLUENT_BIT_PACKAGES_KEY_OVERRIDE
RUN if [ -n "$FLUENT_BIT_PACKAGES_KEY_OVERRIDE" ]; then \
export FLUENT_BIT_PACKAGES_KEY="$FLUENT_BIT_PACKAGES_KEY_OVERRIDE"; \
fi 🌐 Web query:
💡 Result: No, you cannot directly reference a previously defined ARG as the default value of another ARG in a Dockerfile using syntax like Key points and supporting details
In summary: Citations:
Fix ARG default referencing another ARG; derive key URL from the resolved repo URL Docker ARG defaults cannot expand other ARGs. Replace the ARG-based key with an ENV composed from the already-resolved FLUENT_BIT_PACKAGES_URL.
Proposed change: ARG STAGING_URL
ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
-ARG STAGING_KEY=${STAGING_URL}/fluentbit.key
-ENV FLUENT_BIT_PACKAGES_KEY=${STAGING_KEY}
+ENV FLUENT_BIT_PACKAGES_KEY=${FLUENT_BIT_PACKAGES_URL}/fluentbit.key If you need to override the key at build time, accept a build-arg and use it for the ENV (pass via --build-arg): ARG STAGING_URL
ARG FLUENT_BIT_PACKAGES_KEY
ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
ENV FLUENT_BIT_PACKAGES_KEY=${FLUENT_BIT_PACKAGES_KEY}
# docker build --build-arg FLUENT_BIT_PACKAGES_KEY=https://.../fluentbit.key ... 🤖 Prompt for AI Agents
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN wget -qO - $FLUENT_BIT_PACKAGES_KEY | apt-key add - | ||
RUN echo "deb $FLUENT_BIT_PACKAGES_URL/debian/trixie trixie main" >> /etc/apt/sources.list | ||
# hadolint ignore=DL3015,DL3008,DL3009 | ||
RUN apt-get update && apt-get install -y fluent-bit | ||
RUN systemctl enable fluent-bit | ||
|
||
COPY ./test.sh /test.sh | ||
RUN chmod a+x /test.sh | ||
|
||
FROM staging-install as staging-upgrade |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don’t disable TLS verification; remove curl -k and (ideally) verify the download.
Using -k skips certificate validation. At minimum, drop -k. Ideally, also verify the CMake tarball via checksum or signature.
Minimal hardening (remove -k):
If you want, I can provide a follow-up patch to verify SHA-256 against the official cmake-${CMAKE_VERSION}-SHA-256.txt manifest.
📝 Committable suggestion
🧰 Tools
🪛 Checkov (3.2.334)
[HIGH] 181-192: Ensure that certificate validation isn't disabled with curl
(CKV2_DOCKER_2)