diff --git a/Dockerfile.kubectl b/Dockerfile.kubectl new file mode 100644 index 00000000..7fa976ce --- /dev/null +++ b/Dockerfile.kubectl @@ -0,0 +1,8 @@ +FROM bash:5.2.15-alpine3.17 + +ARG TARGETARCH +ARG TARGETOS + +ENV KUBECTL_VERSION="v1.26.4" +ADD https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl /usr/bin/kubectl +RUN chmod +x /usr/bin/kubectl diff --git a/Makefile b/Makefile index 3c41c41c..e7a74643 100644 --- a/Makefile +++ b/Makefile @@ -34,12 +34,22 @@ delete-remote-tag: @echo "Deleting remote tag ${TAG}" @git push --delete origin ${TAG} -build-image: +build-image: build-image-tools build-image-kubectl + +build-image-tools: TAG=$(BUILD_TAG) docker buildx bake -build-image-multiplatform: +build-image-kubectl: + TAG=$(BUILD_TAG) docker buildx bake kubectl + +build-image-multiplatform: build-image-multiplatform-tools build-image-multiplatform-kubectl + +build-image-multiplatform-tools: TAG=$(BUILD_TAG) docker buildx bake tools-multiplatform +build-image-multiplatform-kubectl: + TAG=$(BUILD_TAG) docker buildx bake kubectl-multiplatform + tag-release-image-with-latest: make push-image BUILD_TAG=latest @@ -54,9 +64,14 @@ push-image-cache: # https://github.com/aws/containers-roadmap/issues/876 docker buildx bake cache-multiplatform -push-image: +push-image: push-image-tools push-image-kubectl + +push-image-tools: IMAGE=$(REPO_URL) TAG=$(BUILD_TAG) docker buildx bake tools-multiplatform --push +push-image-kubectl: + IMAGE=$(REPO_URL) TAG=$(BUILD_TAG) docker buildx bake kubectl-multiplatform --push + push-image-ecr: make push-image REPO_URL=$(ECR_REPO_URL) diff --git a/docker-bake.hcl b/docker-bake.hcl index 2d0d53f9..d1b085a2 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -39,10 +39,21 @@ target "default" { platforms = ["linux/amd64"] } +target "kubectl" { + dockerfile = "Dockerfile.kubectl" + tags = ["${IMAGE}-kubectl:${TAG}"] + output = ["type=docker"] + platforms = ["linux/amd64"] +} + target "tools-multiplatform" { inherits = ["default", "multiplatform"] } +target "kubeclt-multiplatform" { + inherits = ["kubectl", "multiplatform"] +} + group "cache" { targets = ["rust-cache", "go-cache", "tools-cache"] }