fix(docker): make kubectl-delivery base image and k8s version configurable#2
fix(docker): make kubectl-delivery base image and k8s version configurable#2vicoooo26 wants to merge 2 commits into
Conversation
|
🎉 Welcome to the Kubeflow Trainer! 🎉 Thanks for opening your first PR! We're happy to have you as part of our community 🚀 Here's what happens next:
Join the community:
Feel free to ask questions in the comments if you need any help or clarification! |
…rable Add ALPINE_VERSION (default 3.22) and K8S_VERSION (default v1.30.7) as build args so they can be overridden via --build-arg without editing the Dockerfile. Signed-off-by: Vico Chu <vico24826@gmail.com>
50b5d5b to
3b339d4
Compare
cheyang
left a comment
There was a problem hiding this comment.
Verified this locally: built the image with defaults (→ alpine 3.22.5, kubectl v1.30.7) and with --build-arg ALPINE_VERSION=3.20 --build-arg K8S_VERSION=v1.29.10 (→ alpine 3.20.10, kubectl v1.29.10). The global ARG ALPINE_VERSION declared before the first FROM is correctly referenced by both stages. Looks good.
Optional, non-blocking: the kubectl download still isn’t checksum-verified (pre-existing). Since you’re already touching this file, adding a sha256 check would be a nice hardening.
There was a problem hiding this comment.
Pull request overview
This PR makes the kubectl-delivery container image easier to customize by parameterizing previously hardcoded versions in the Dockerfile, while also upgrading the default Alpine base image.
Changes:
- Introduces
ARG ALPINE_VERSION=3.22and uses it for both build and runtime stages (FROM alpine:${ALPINE_VERSION}). - Switches Kubernetes version from a hardcoded
ENVtoARG K8S_VERSION=v1.30.7so it can be overridden at build time.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Download the official .sha256 from dl.k8s.io and verify the binary before installing, preventing use of a tampered kubectl.
What this PR does / why we need it:
Makes the kubectl-delivery Dockerfile more flexible by extracting hardcoded Alpine and Kubernetes versions into build args:
ALPINE_VERSION(default3.22) — replaces the hardcodedalpine:3.17in both build and final stagesK8S_VERSION(defaultv1.30.7) — replaces the hardcodedENV K8S_VERSIONwith anARG, allowing override via--build-argThis also upgrades the Alpine base from 3.17 to 3.22, bringing security fixes and updated packages. Both values can now be overridden at build time without editing the Dockerfile.