|
1 | | -FROM alpine:3.21 AS builder |
| 1 | +FROM alpine:3.20 AS builder |
2 | 2 |
|
3 | | -RUN apk add --no-cache curl |
| 3 | +RUN apk update && apk add curl |
4 | 4 |
|
5 | | -ARG TARGETARCH |
6 | | -WORKDIR /tmp/kubectl-versions |
7 | | -RUN curl -o kubectl1.6 -L https://storage.googleapis.com/kubernetes-release/release/v1.6.0/bin/linux/${TARGETARCH}/kubectl |
8 | | -RUN curl -o kubectl1.10 -L https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/${TARGETARCH}/kubectl |
9 | | -RUN curl -o kubectl1.11 -L https://storage.googleapis.com/kubernetes-release/release/v1.11.0/bin/linux/${TARGETARCH}/kubectl |
10 | | -RUN curl -o kubectl1.12 -L https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/${TARGETARCH}/kubectl |
11 | | -RUN curl -o kubectl1.13 -L https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/${TARGETARCH}/kubectl |
12 | | -RUN curl -o kubectl1.14 -L https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/${TARGETARCH}/kubectl |
13 | | -RUN curl -o kubectl1.15 -L https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/linux/${TARGETARCH}/kubectl |
14 | | -RUN curl -o kubectl1.16 -L https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/linux/${TARGETARCH}/kubectl |
15 | | -RUN curl -o kubectl1.17 -L https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/${TARGETARCH}/kubectl |
16 | | -RUN curl -o kubectl1.18 -L https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/${TARGETARCH}/kubectl |
17 | | -RUN curl -o kubectl1.19 -L https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/${TARGETARCH}/kubectl |
18 | | -RUN curl -o kubectl1.20 -L https://storage.googleapis.com/kubernetes-release/release/v1.20.0/bin/linux/${TARGETARCH}/kubectl |
19 | | -RUN curl -o kubectl1.21 -L https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/${TARGETARCH}/kubectl |
20 | | -RUN curl -o kubectl1.22 -L https://storage.googleapis.com/kubernetes-release/release/v1.22.0/bin/linux/${TARGETARCH}/kubectl |
21 | | -RUN curl -o kubectl1.23 -L https://storage.googleapis.com/kubernetes-release/release/v1.23.0/bin/linux/${TARGETARCH}/kubectl |
22 | | -RUN curl -o kubectl1.24 -L https://storage.googleapis.com/kubernetes-release/release/v1.24.0/bin/linux/${TARGETARCH}/kubectl |
23 | | -RUN curl -o kubectl1.25 -L https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/${TARGETARCH}/kubectl |
24 | | -RUN curl -o kubectl1.26 -L https://storage.googleapis.com/kubernetes-release/release/v1.26.0/bin/linux/${TARGETARCH}/kubectl |
25 | | -RUN curl -o kubectl1.27 -L https://storage.googleapis.com/kubernetes-release/release/v1.27.0/bin/linux/${TARGETARCH}/kubectl |
26 | | -RUN curl -o kubectl1.28 -L https://storage.googleapis.com/kubernetes-release/release/v1.28.0/bin/linux/${TARGETARCH}/kubectl |
27 | | -RUN curl -o kubectl1.29 -L https://storage.googleapis.com/kubernetes-release/release/v1.29.0/bin/linux/${TARGETARCH}/kubectl |
28 | | -RUN curl -o kubectl1.30 -L https://storage.googleapis.com/kubernetes-release/release/v1.30.0/bin/linux/${TARGETARCH}/kubectl |
29 | | -RUN curl -o kubectl1.31 -L https://storage.googleapis.com/kubernetes-release/release/v1.31.0/bin/linux/${TARGETARCH}/kubectl |
| 5 | +RUN export ARCH=$([[ "$(uname -m)" == "aarch64" ]] && echo "arm64" || echo "amd64") && \ |
| 6 | + mkdir -p /tmp/kubectl-versions && cd /tmp/kubectl-versions && \ |
| 7 | + curl -o kubectl1.30 -L https://storage.googleapis.com/kubernetes-release/release/v1.30.0/bin/linux/${ARCH}/kubectl && \ |
| 8 | + curl -o kubectl1.29 -L https://storage.googleapis.com/kubernetes-release/release/v1.29.0/bin/linux/${ARCH}/kubectl && \ |
| 9 | + curl -o kubectl1.28 -L https://storage.googleapis.com/kubernetes-release/release/v1.28.0/bin/linux/${ARCH}/kubectl && \ |
| 10 | + curl -o kubectl1.27 -L https://storage.googleapis.com/kubernetes-release/release/v1.27.0/bin/linux/${ARCH}/kubectl && \ |
| 11 | + curl -o kubectl1.26 -L https://storage.googleapis.com/kubernetes-release/release/v1.26.0/bin/linux/${ARCH}/kubectl && \ |
| 12 | + curl -o kubectl1.25 -L https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/${ARCH}/kubectl && \ |
| 13 | + curl -o kubectl1.24 -L https://storage.googleapis.com/kubernetes-release/release/v1.24.0/bin/linux/${ARCH}/kubectl && \ |
| 14 | + curl -o kubectl1.23 -L https://storage.googleapis.com/kubernetes-release/release/v1.23.0/bin/linux/${ARCH}/kubectl && \ |
| 15 | + curl -o kubectl1.22 -L https://storage.googleapis.com/kubernetes-release/release/v1.22.0/bin/linux/${ARCH}/kubectl && \ |
| 16 | + curl -o kubectl1.21 -L https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/${ARCH}/kubectl && \ |
| 17 | + curl -o kubectl1.20 -L https://storage.googleapis.com/kubernetes-release/release/v1.20.0/bin/linux/${ARCH}/kubectl && \ |
| 18 | + curl -o kubectl1.19 -L https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/${ARCH}/kubectl && \ |
| 19 | + curl -o kubectl1.18 -L https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/${ARCH}/kubectl && \ |
| 20 | + curl -o kubectl1.17 -L https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/${ARCH}/kubectl && \ |
| 21 | + curl -o kubectl1.16 -L https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/linux/${ARCH}/kubectl && \ |
| 22 | + curl -o kubectl1.15 -L https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/linux/${ARCH}/kubectl && \ |
| 23 | + curl -o kubectl1.14 -L https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/${ARCH}/kubectl && \ |
| 24 | + curl -o kubectl1.13 -L https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/${ARCH}/kubectl && \ |
| 25 | + curl -o kubectl1.12 -L https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/${ARCH}/kubectl && \ |
| 26 | + curl -o kubectl1.11 -L https://storage.googleapis.com/kubernetes-release/release/v1.11.0/bin/linux/${ARCH}/kubectl && \ |
| 27 | + curl -o kubectl1.10 -L https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/${ARCH}/kubectl && \ |
| 28 | + curl -o kubectl1.6 -L https://storage.googleapis.com/kubernetes-release/release/v1.6.0/bin/linux/${ARCH}/kubectl |
| 29 | + |
| 30 | + |
| 31 | +FROM debian:bookworm-20240812-slim |
| 32 | + |
| 33 | +RUN apt-get update -y |
| 34 | +# install busybox by building source until it's unavailable by apt-get for v1.36.1 ad no need to link [[ |
| 35 | +RUN apt-get install --no-install-recommends wget build-essential -y && \ |
| 36 | + wget --no-check-certificate https://busybox.net/downloads/busybox-1.36.1.tar.bz2 && \ |
| 37 | + tar -xvjf busybox-1.36.1.tar.bz2 && \ |
| 38 | + cd busybox-1.36.1 && \ |
| 39 | + make defconfig && \ |
| 40 | + make && \ |
| 41 | + make CONFIG_PREFIX="/" install |
30 | 42 |
|
31 | | -FROM debian:bookworm-20250407-slim |
32 | | -WORKDIR / |
33 | 43 | RUN adduser --gecos "" --disabled-password --home /home/cfu --shell /bin/bash cfu |
34 | | -USER cfu |
35 | 44 |
|
36 | | -# copy all versions of kubectl to switch between them later. |
37 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.6 /usr/local/bin/ |
| 45 | +#copy all versions of kubectl to switch between them later. |
| 46 | +COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/* /usr/local/bin/ |
38 | 47 | COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.10 /usr/local/bin/kubectl |
39 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.11 /usr/local/bin/ |
40 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.12 /usr/local/bin/ |
41 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.13 /usr/local/bin/ |
42 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.14 /usr/local/bin/ |
43 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.15 /usr/local/bin/ |
44 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.16 /usr/local/bin/ |
45 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.17 /usr/local/bin/ |
46 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.18 /usr/local/bin/ |
47 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.19 /usr/local/bin/ |
48 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.20 /usr/local/bin/ |
49 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.21 /usr/local/bin/ |
50 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.22 /usr/local/bin/ |
51 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.23 /usr/local/bin/ |
52 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.24 /usr/local/bin/ |
53 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.25 /usr/local/bin/ |
54 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.26 /usr/local/bin/ |
55 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.27 /usr/local/bin/ |
56 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.28 /usr/local/bin/ |
57 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.29 /usr/local/bin/ |
58 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.30 /usr/local/bin/ |
59 | | -COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.31 /usr/local/bin/ |
60 | | - |
61 | | -COPY --chown=cfu --chmod=775 cf-deploy-kubernetes.sh /cf-deploy-kubernetes |
62 | | -COPY --chown=cfu --chmod=775 template.sh /template.sh |
63 | 48 |
|
| 49 | +WORKDIR / |
| 50 | +ADD --chown=cfu --chmod=775 cf-deploy-kubernetes.sh /cf-deploy-kubernetes |
| 51 | +ADD --chown=cfu --chmod=775 template.sh /template.sh |
| 52 | +USER cfu |
64 | 53 | CMD ["bash"] |
0 commit comments