Skip to content

[WIP] distribution: Build the ubuntu container images with rules_oci and rules_distroless - #49260

Closed
phlax wants to merge 3 commits into
envoyproxy:mainfrom
phlax:ubuntu-rules-distroless
Closed

phlax wants to merge 3 commits into
envoyproxy:mainfrom
phlax:ubuntu-rules-distroless

Conversation

@phlax

@phlax phlax commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Commit Message: distribution: Build the ubuntu container images with rules_oci and rules_distroless
Additional Description:

Stacked on #49259 (the first commit here); this PR is the second commit. The third commit (TEST:) overrides envoy_toolshed with envoyproxy/toolshed#5597 (oci_base_edit, cherry-picked onto the v0.5.20 release) to test it, and goes once that is released.

Builds the ubuntu-based images (envoy, envoy-debug, envoy-contrib, envoy-contrib-debug, envoy-tools) with rules_oci, so that all of the release container images are built by bazel, and the Docker OCI job (docker-in-docker buildx, after downloading the binaries) goes away.

  • Base: ubuntu:22.04 at the digest pinned in Dockerfile-envoy (oci.pull).
  • Packages: ca-certificates, openssl and tzdata from a pinned snapshot.ubuntu.com timestamp (rules_distroless apt). These are the packages the apt layer adds today; their dependencies are in the base.
  • The RUN steps of the envoy-base stage become layers:
    • oci_base_edit (toolshed): reads the base image's passwd/group/shadow/gshadow and dpkg status, and adds envoy as adduser --group --system envoy does (uid/gid 101 on this base), /home/envoy, and the three packages to the dpkg status;
    • the package data, the CA bundle (cacerts), and /etc/timezone / /etc/localtime (Etc/UTC), which the package maintainer scripts would otherwise create.
  • Same files, modes and config as the Dockerfile stages: /etc/envoy/{envoy.yaml,VERSION.txt}, /docker-entrypoint.sh, su-exec, envoy (+ .dwp for debug), the tools for -tools, entrypoint/cmd, DEBIAN_FRONTEND, port 10000.

CI: release builds all images (//distribution/docker:images) into build_images/envoy*.<amd64|arm64>.tar; the binary job uploads them as oci.<arch>, the artifact the verify and container publishing jobs already use; the Docker OCI job is removed. Local docker builds still use buildx.

Differences from the buildx images:

  • No apt-get upgrade: base packages are those of the pinned base until its digest (and the snapshot) is bumped, rather than whatever was current at build time.
  • Only the CA bundle in /etc/ssl/certs, not the per-certificate hash links.

Risk Level: medium (release container images)
Testing: CI (verify jobs use the built images)
Docs Changes: n/a
Release Notes: n/a

@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #49260 was opened by phlax.

see: more, trace.

Build `envoy-distroless` and `envoy-contrib-distroless` with rules_oci,
from the pinned distroless base and the release binaries, instead of with
`docker buildx`.

The images match the `envoy-distroless` stage of `Dockerfile-envoy`.
`release` builds them for the target platform with the release binaries,
and adds the OCI tarballs to the release binary directory. `docker`
collects them as `envoy-distroless.<arch>.tar` and
`envoy-contrib-distroless.<arch>.tar`, as `build.sh` names them, and skips
building them with buildx (`DOCKER_SKIP_DISTROLESS`). Local multi-platform
and load builds are unchanged.

Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax force-pushed the ubuntu-rules-distroless branch 5 times, most recently from 6f213cc to 4659d37 Compare November 14, 2026 12:34
…les_distroless

Build the `envoy`, `envoy-debug`, `envoy-contrib`, `envoy-contrib-debug`
and `envoy-tools` images with rules_oci, on the pinned ubuntu base, with
`ca-certificates`, `openssl` and `tzdata` from an Ubuntu snapshot
(rules_distroless), as the `envoy` stages of `Dockerfile-envoy` do.

The `RUN` steps of the `envoy-base` stage are replaced with layers: the
base users and groups with the `envoy` system user and group, its home
directory, the package data, the certificate bundle (`cacerts`), and the
timezone settings that the package maintainer scripts would create.
`apt-get upgrade` is dropped: the base image digest and the snapshot pin
what is installed.

`release` builds all of the container images, and writes them to
`build_images`, as `docker` names them. The binary job uploads them as
`oci.<arch>`, and the Docker OCI job is removed.

Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax force-pushed the ubuntu-rules-distroless branch from 4659d37 to ab9e6ff Compare November 14, 2026 12:44
@phlax

phlax commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

Combined with the distroless images into #49259 (all of the release images with rules_oci, collected by the existing Docker OCI job, no workflow changes).

@phlax phlax closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant