Skip to content

Switch to slim base images for components and frontend#12927

Open
jsonmp-k8 wants to merge 1 commit intokubeflow:masterfrom
jsonmp-k8:use-slim-base-images
Open

Switch to slim base images for components and frontend#12927
jsonmp-k8 wants to merge 1 commit intokubeflow:masterfrom
jsonmp-k8:use-slim-base-images

Conversation

@jsonmp-k8
Copy link
Contributor

@jsonmp-k8 jsonmp-k8 commented Feb 27, 2026

Summary

Use slim variants of base images in component definitions and the frontend Dockerfile to reduce container image sizes. This targets components that do not require system tools like git or gcc at runtime.

  • frontend: node:22.19 -> node:22.19-slim
  • Google Cloud starry_net (8 components): python:3.9 -> python:3.9-slim
  • Google Cloud forecasting: python:3.8 -> python:3.8-slim
  • Snowflake (2 files): python:3.11 -> python:3.11-slim
  • PyTorch launcher sample: python:3.11 -> python:3.11-slim

The SDK default base image (python:3.11) is intentionally unchanged, as lightweight Python components rely on system tools (e.g. git) that are not available in slim images.

Test plan

  • Verify all pre-commit checks pass
  • Verify E2E tests pass (no impact expected since only explicit component images are changed, not the SDK default)
  • Verify frontend builds successfully with node:22.19-slim

Copilot AI review requested due to automatic review settings February 27, 2026 03:25
@github-actions
Copy link

🎉 Welcome to the Kubeflow Pipelines repo! 🎉

Thanks for opening your first PR! We're excited to have you onboard 🚀

Next steps:

Feel free to ask questions in the comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR switches from full base images to slim variants across Dockerfiles, SDK defaults, and component definitions to reduce container image sizes. The change affects the default KFP component base image (reducing it from ~900MB to ~150MB), backend/frontend Dockerfiles, and numerous existing component definitions across the codebase.

Changes:

  • Updates the SDK's _DEFAULT_BASE_IMAGE from python:3.11 to python:3.11-slim
  • Switches backend Dockerfile to use python:3.11-slim (compiler stage) and debian:stable-slim (runtime stage)
  • Switches frontend Dockerfile to use node:22.19-slim for the build stage
  • Updates 18 component definitions to use slim Python base images (3.7-slim, 3.8-slim, 3.9-slim, 3.11-slim)

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/python/kfp/dsl/component_factory.py Changes default base image constant to python:3.11-slim
sdk/python/kfp/dsl/component_decorator.py Updates docstring example to use python:3.11-slim
backend/Dockerfile Switches compiler stage to python:3.11-slim and runtime stage to debian:stable-slim
frontend/Dockerfile Switches build stage to node:22.19-slim
samples/core/secret/secret.py Updates to python:3.7-slim
components/snowflake/snowflake_unload_data.py Updates to python:3.11-slim
components/snowflake/component.yaml Updates compiled YAML to python:3.11-slim
components/kubeflow/pytorch-launcher/sample.py Updates to python:3.11-slim
components/google-cloud/.../prepare_data_for_train/component.py Updates to python:3.8-slim
components/google-cloud/...starry_net/upload_decomposition_plots/component.py Updates to python:3.9-slim
components/google-cloud/...starry_net/set_train_args/component.py Updates to python:3.9-slim
components/google-cloud/...starry_net/set_tfrecord_args/component.py Updates to python:3.9-slim
components/google-cloud/...starry_net/set_test_set/component.py Updates to python:3.9-slim
components/google-cloud/...starry_net/set_eval_args/component.py Updates to python:3.9-slim
components/google-cloud/...starry_net/set_dataprep_args/component.py Updates to python:3.9-slim
components/google-cloud/...starry_net/maybe_set_tfrecord_args/component.py Updates to python:3.9-slim
components/google-cloud/...starry_net/get_training_artifacts/component.py Updates to python:3.9-slim
backend/test/resources/artifact_pipeline.py Updates test to python:3.11-slim

@jsonmp-k8
Copy link
Contributor Author

/ok-to-test

Use slim variants of base images in component definitions and frontend
Dockerfile to reduce container image sizes. This targets components
that do not require system tools like git or gcc at runtime.

Changes:
- frontend: node:22.19 -> node:22.19-slim
- Google Cloud starry_net components: python:3.9 -> python:3.9-slim
- Google Cloud forecasting: python:3.8 -> python:3.8-slim
- Snowflake components: python:3.11 -> python:3.11-slim
- PyTorch launcher sample: python:3.11 -> python:3.11-slim

The SDK default base image (python:3.11) is intentionally not changed
as lightweight Python components rely on system tools (e.g. git) that
are not available in slim images.

Signed-off-by: Jaison Paul <paul.jaison@gmail.com>
@jsonmp-k8 jsonmp-k8 force-pushed the use-slim-base-images branch from a0399cf to d0cead2 Compare February 27, 2026 23:38
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign chensun for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot added size/S and removed size/XXL labels Feb 27, 2026
@jsonmp-k8 jsonmp-k8 changed the title Switch to slim base images to reduce container image sizes Switch to slim base images for components and frontend Feb 27, 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.

2 participants