Skip to content

Commit 0a20770

Browse files
author
Dominik Rosiek
committed
feat: build kubernetes-tools-kubectl image
Signed-off-by: Dominik Rosiek <[email protected]>
1 parent 3c8602a commit 0a20770

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

Dockerfile.kubectl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM bash:5.2.15-alpine3.17
2+
3+
ARG TARGETARCH
4+
ARG TARGETOS
5+
6+
ENV KUBECTL_VERSION="v1.22.4"
7+
8+
RUN apk update && apk add curl
9+
10+
RUN mkdir -p /usr/bin
11+
RUN curl -LJ https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl -o /usr/bin/kubectl
12+
RUN chmod +x /usr/bin/kubectl

Makefile

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,22 @@ delete-remote-tag:
3434
@echo "Deleting remote tag ${TAG}"
3535
@git push --delete origin ${TAG}
3636

37-
build-image:
37+
build-image: build-image-tools build-image-kubectl
38+
39+
build-image-tools:
3840
TAG=$(BUILD_TAG) docker buildx bake
3941

40-
build-image-multiplatform:
42+
build-image-kubectl:
43+
TAG=$(BUILD_TAG) docker buildx bake kubectl
44+
45+
build-image-multiplatform: build-image-multiplatform-tools build-image-multiplatform-kubectl
46+
47+
build-image-multiplatform-tools:
4148
TAG=$(BUILD_TAG) docker buildx bake tools-multiplatform
4249

50+
build-image-multiplatform-kubectl:
51+
TAG=$(BUILD_TAG) docker buildx bake kubectl-multiplatform
52+
4353
tag-release-image-with-latest:
4454
make push-image BUILD_TAG=latest
4555

@@ -54,9 +64,14 @@ push-image-cache:
5464
# https://github.com/aws/containers-roadmap/issues/876
5565
docker buildx bake cache-multiplatform
5666

57-
push-image:
67+
push-image: push-image-tools push-image-kubectl
68+
69+
push-image-tools:
5870
IMAGE=$(REPO_URL) TAG=$(BUILD_TAG) docker buildx bake tools-multiplatform --push
5971

72+
push-image-kubectl:
73+
IMAGE=$(REPO_URL) TAG=$(BUILD_TAG) docker buildx bake kubectl-multiplatform --push
74+
6075
push-image-ecr:
6176
make push-image REPO_URL=$(ECR_REPO_URL)
6277

docker-bake.hcl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,21 @@ target "default" {
3939
platforms = ["linux/amd64"]
4040
}
4141

42+
target "kubectl" {
43+
dockerfile = "Dockerfile.kubectl"
44+
tags = ["${IMAGE}-kubectl:${TAG}"]
45+
output = ["type=docker"]
46+
platforms = ["linux/amd64"]
47+
}
48+
4249
target "tools-multiplatform" {
4350
inherits = ["default", "multiplatform"]
4451
}
4552

53+
target "kubeclt-multiplatform" {
54+
inherits = ["kubectl", "multiplatform"]
55+
}
56+
4657
group "cache" {
4758
targets = ["rust-cache", "go-cache", "tools-cache"]
4859
}

0 commit comments

Comments
 (0)