Skip to content

Conversation

@artyom-morozov
Copy link
Collaborator

@artyom-morozov artyom-morozov commented Oct 27, 2025

DATAGO-115758

@artyom-morozov artyom-morozov force-pushed the art/docker_optimization branch from b926325 to 4ca4300 Compare October 27, 2025 21:08
@artyom-morozov artyom-morozov changed the title perf: optimize Dockerfile cache ci(): optimize Dockerfile cache Oct 28, 2025
@artyom-morozov artyom-morozov changed the title ci(): optimize Dockerfile cache ci(DATAGO-115758): optimize Dockerfile cache Oct 28, 2025
@artyom-morozov artyom-morozov changed the base branch from mradwan/docker_optimization to main October 28, 2025 16:37
@artyom-morozov artyom-morozov force-pushed the art/docker_optimization branch 2 times, most recently from 0ab3cf9 to e2aee55 Compare October 28, 2025 16:46
@github-actions
Copy link

github-actions bot commented Oct 28, 2025

WhiteSource Policy Violation Summary

✅︎ No Blocking Whitesource Policy Violations found in solaceai/solace-agent-mesh-pr-457!

Copy link
Collaborator

@mo-radwan1 mo-radwan1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thank you Art for taking care of this

Comment on lines 57 to 87
source_image="${{ inputs.source_registry }}/solace-agent-mesh:${{ inputs.source_image_tag }}"
echo "Pulling multi-platform image from ECR: ${source_image}"
# Pull the multi-platform manifest and both platform images
docker pull --platform linux/amd64 "${source_image}-amd64"
docker pull --platform linux/arm64 "${source_image}-arm64"
# Convert comma-separated tags to array
IFS=',' read -ra TAGS <<< "${{ steps.docker_tags.outputs.TAGS_LIST }}"
# For each target tag, create a multi-platform manifest
for TAG in "${TAGS[@]}"; do
TAG=$(echo "$TAG" | xargs) # Trim whitespace
echo "Creating multi-platform manifest for: ${TAG}"
# Tag the platform-specific images for DockerHub
docker tag "${source_image}-amd64" "${TAG}-amd64"
docker tag "${source_image}-arm64" "${TAG}-arm64"
# Push platform-specific images
docker push "${TAG}-amd64"
docker push "${TAG}-arm64"
# Create and push multi-platform manifest
docker buildx imagetools create \
--tag "${TAG}" \
"${TAG}-amd64" \
"${TAG}-arm64"
docker push "${TAG}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Skopeo would be good to use here since we're just retagging and pushing rather than building

Comment on lines 57 to 60
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should pin this sha

@artyom-morozov artyom-morozov force-pushed the art/docker_optimization branch 2 times, most recently from f9cf54b to 258649d Compare October 31, 2025 19:11
mo-radwan1 and others added 9 commits November 3, 2025 14:48
Comprehensive Dockerfile optimization for improved build performance,
multi-architecture support, and licensing compliance.

## Performance Optimizations

**Migrated from pip to uv (build stage only):**
- 10-100x faster package installation with parallel downloads
- BuildKit cache mounts for persistent dependency caching
- npm cache mount for faster frontend builds

**Optimized layer caching:**
- Install build tools BEFORE copying dependency files
- Dependency metadata copied before source code
- Better cache hit rates on code-only changes

**Multi-architecture support:**
- Added TARGETARCH and TARGETPLATFORM support
- Architecture-specific cache IDs to prevent cross-contamination
- Works with: docker buildx build --platform linux/amd64,linux/arm64

## Licensing & Compliance Fixes

**Runtime stage uses pip (not uv):**
- Addresses licensing attribution requirements for uv and its dependencies
- uv only used in build stage (discarded, no licensing obligations)
- pip is built-in to Python (no additional licenses)

**Removed PIP_NO_CACHE_DIR=1:**
- Enables pip caching for faster builds
- Works with cache mounts for optimal performance

## Changes Summary

**Build stage:**
- ✅ Uses uv with cache mounts (fast builds)
- ✅ Install hatch before COPY (better caching)
- ✅ npm cache mount for frontend
- ✅ BuildKit cache mounts

**Runtime stage:**
- ✅ Uses pip (licensing compliant)
- ✅ No uv in any layer (clean layer history)
- ✅ Minimal dependencies
- ✅ Smaller image footprint

## Expected Performance Gains

| Scenario | Improvement |
|----------|-------------|
| First build | 20-40% faster |
| Rebuild (code change) | 60-80% faster |
| Rebuild (deps unchanged) | 90% faster |

## Compliance

- Linux Foundation layer attribution requirements met
- No uv licensing obligations in final image
- Clean layer history for auditing

Co-authored-by: Artyom Morozov (layer caching optimization)
Co-authored-by: Samuel Gamelin (licensing compliance feedback)
@artyom-morozov artyom-morozov force-pushed the art/docker_optimization branch from 258649d to 1232d1f Compare November 3, 2025 19:49
@sonarqube-solacecloud
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants