Repository navigation
Add Docker 29 Universal image squash comparison workflow - #2107
Closed
Kaniska (v-Kaniska244) wants to merge 2 commits into
Closed
Kaniska (v-Kaniska244) wants to merge 2 commits into
Kaniska (v-Kaniska244) wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Comment on lines
+8
to
+111
| name: Compare Docker 29 image sizes | ||
| runs-on: devcontainer-image-builder-ubuntu | ||
| env: | ||
| DOCKER_MAJOR_VERSION: "29" | ||
| IMAGE: mcr.microsoft.com/devcontainers/universal:6.1.14-noble | ||
| SQUASHED_IMAGE: devcontainers/universal:6.1.14-noble-squashed | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Verify Docker version | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| current_version="$(docker version --format '{{.Server.Version}}' 2>/dev/null || true)" | ||
| current_major="${current_version%%.*}" | ||
| echo "Docker version before setup: ${current_version:-unavailable}" | ||
|
|
||
| if [[ "$current_major" != "$DOCKER_MAJOR_VERSION" ]]; then | ||
| sudo apt-get update | ||
| sudo apt-get install -y ca-certificates curl | ||
| sudo install -m 0755 -d /etc/apt/keyrings | ||
| sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ | ||
| -o /etc/apt/keyrings/docker.asc | ||
| sudo chmod a+r /etc/apt/keyrings/docker.asc | ||
|
|
||
| . /etc/os-release | ||
| ubuntu_codename="${UBUNTU_CODENAME:-$VERSION_CODENAME}" | ||
| architecture="$(dpkg --print-architecture)" | ||
| echo \ | ||
| "deb [arch=${architecture} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu ${ubuntu_codename} stable" \ | ||
| | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null | ||
| sudo apt-get update | ||
|
|
||
| docker_ce_version="$( | ||
| apt-cache madison docker-ce | | ||
| awk -v major="$DOCKER_MAJOR_VERSION" '$3 ~ "^5:" major "\\." { print $3; exit }' | ||
| )" | ||
| docker_cli_version="$( | ||
| apt-cache madison docker-ce-cli | | ||
| awk -v major="$DOCKER_MAJOR_VERSION" '$3 ~ "^5:" major "\\." { print $3; exit }' | ||
| )" | ||
| if [[ -z "$docker_ce_version" || -z "$docker_cli_version" ]]; then | ||
| echo "Docker ${DOCKER_MAJOR_VERSION}.x is not available from the Docker APT repository." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| sudo apt-get install -y \ | ||
| "docker-ce=${docker_ce_version}" \ | ||
| "docker-ce-cli=${docker_cli_version}" \ | ||
| containerd.io \ | ||
| docker-buildx-plugin \ | ||
| docker-compose-plugin | ||
| sudo systemctl enable --now docker | ||
| fi | ||
|
|
||
| installed_version="$(docker version --format '{{.Server.Version}}')" | ||
| installed_major="${installed_version%%.*}" | ||
| echo "Docker version after setup: ${installed_version}" | ||
| [[ "$installed_major" == "$DOCKER_MAJOR_VERSION" ]] || { | ||
| echo "Expected Docker ${DOCKER_MAJOR_VERSION}.x, got ${installed_version}." >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| - name: Install docker-squash | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| sudo apt-get update | ||
| sudo apt-get install -y python3 python3-venv | ||
| python3 -m venv "${RUNNER_TEMP}/docker-squash" | ||
| "${RUNNER_TEMP}/docker-squash/bin/pip" install \ | ||
| "git+https://github.com/goldmann/docker-squash.git" | ||
| echo "${RUNNER_TEMP}/docker-squash/bin" >> "${GITHUB_PATH}" | ||
| "${RUNNER_TEMP}/docker-squash/bin/docker-squash" --version | ||
|
|
||
| - name: Pull and squash Universal image | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| docker pull "$IMAGE" | ||
| docker-squash -t "$SQUASHED_IMAGE" "$IMAGE" | ||
|
|
||
| - name: Compare image sizes | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| original_size="$(docker image inspect "$IMAGE" --format '{{.Size}}')" | ||
| squashed_size="$(docker image inspect "$SQUASHED_IMAGE" --format '{{.Size}}')" | ||
| original_human="$(docker image ls "$IMAGE" --format '{{.Size}}')" | ||
| squashed_human="$(docker image ls "$SQUASHED_IMAGE" --format '{{.Size}}')" | ||
| size_difference=$((original_size - squashed_size)) | ||
| percentage_saved="$( | ||
| awk -v original="$original_size" -v difference="$size_difference" \ | ||
| 'BEGIN { if (original == 0) print "0.00"; else printf "%.2f", difference * 100 / original }' | ||
| )" | ||
|
|
||
| echo "Original image: ${IMAGE}" | ||
| echo " Size: ${original_size} bytes (${original_human})" | ||
| echo "Squashed image: ${SQUASHED_IMAGE}" | ||
| echo " Size: ${squashed_size} bytes (${squashed_human})" | ||
| echo "Size difference: ${size_difference} bytes (${percentage_saved}% saved)" |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The workflow’s pinned Docker installation fails on runners with newer versions, and its unpinned docker-squash revision prevents reproducible comparisons with the publishing setup.
2 open issues
What changed in this PR
Adds a manually triggered Docker 29 workflow to measure Universal image size savings, complementing the squashing work in #2028.
Changes:
- Checks for Docker 29.x and installs it from Docker’s official APT repository when needed.
- Installs
docker-squashin an isolated Python environment and squashesuniversal:6.1.14-noble. - Reports original and squashed image sizes, byte differences, and percentage savings.
| File | Description |
|---|---|
.github/workflows/docker-squash-v29.yml |
Adds Docker setup, Universal image squashing, and size comparison on the image-builder runner. |
Review effort: Balanced
| exit 1 | ||
| fi | ||
|
|
||
| sudo apt-get install -y \ |
| sudo apt-get install -y python3 python3-venv | ||
| python3 -m venv "${RUNNER_TEMP}/docker-squash" | ||
| "${RUNNER_TEMP}/docker-squash/bin/pip" install \ | ||
| "git+https://github.com/goldmann/docker-squash.git" |
Kaniska (v-Kaniska244)
marked this pull request as draft
November 17, 2026 06:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds a manually triggered workflow on
devcontainer-image-builder-ubuntuthat:docker-squashin an isolated Python virtual environment, matching Universal image squash #2028.mcr.microsoft.com/devcontainers/universal:6.1.14-noble.Validation
bash -n.git diff --checkpassed.