refactor: use minimal distroless base image to reduce image size#495
Open
balcsida wants to merge 2 commits intoAzure:mainfrom
Open
refactor: use minimal distroless base image to reduce image size#495balcsida wants to merge 2 commits intoAzure:mainfrom
balcsida wants to merge 2 commits intoAzure:mainfrom
Conversation
Contributor
Author
|
/AzurePipelines help |
Supported commands
See additional documentation. |
Contributor
Author
|
/AzurePipelines run |
|
Commenter does not have sufficient privileges for PR 495 in repo Azure/acr-cli |
…th essential libraries
3b49628 to
ac308b8
Compare
a8b62f2 to
e648785
Compare
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
This PR optimizes the Docker image size by 73%, reducing it from 95.5MB to ~25-28MB while maintaining full functionality and FIPS compliance across both x86_64 and ARM64 platforms.
Cross-Platform Optimization Results
Optimization Journey & Testing Results
We systematically tested multiple approaches to find the optimal solution:
Key Findings
/lib64and/usr/lib64Changes Made
Dockerfile Optimization
mcr.microsoft.com/azurelinux/base/core:3.0(95.5MB)mcr.microsoft.com/azurelinux/distroless/minimal:3.0(25-28MB)Cross-Platform Technical Implementation
The solution uses multi-stage build with platform-agnostic library copying:
Platform-specific dynamic linkers supported:
/usr/lib/ld-linux-x86-64.so.2/lib/ld-linux-aarch64.so.1Essential libraries included:
libc.so.6,libdl.so.2,libpthread.so.0- Core runtimelibresolv.so.2,librt.so.1- Network and real-time supportlibssl.so*,libcrypto.so*- FIPS complianceBuild Context Optimization
.dockerignorefileComprehensive Testing
Cross-Platform Validation
Docker Container Functionality Tests
Integration Tests
Authentication Testing
Validated multiple auth approaches on both platforms:
az acr login --expose-token(chosen solution)Performance Testing
Benefits
Compatibility
Performance Impact
Testing Infrastructure Added
Added
scripts/experimental/test-purge-docker.shwith comprehensive test coverage: