Skip to content

Commit

Permalink
chore(): updated base image to bookworm , updated kubectl (#71)
Browse files Browse the repository at this point in the history
* updated base image to bookworm , updated kubectl

* added more versions
  • Loading branch information
vitalii-codefresh authored Aug 21, 2024
1 parent d48aae9 commit 97f2400
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 36 deletions.
23 changes: 18 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
FROM alpine:3.6 AS builder
FROM alpine:3.20 AS builder

RUN apk update && apk add curl

RUN export ARCH=$([[ "$(uname -m)" == "aarch64" ]] && echo "arm64" || echo "amd64") && \
mkdir -p /tmp/kubectl-versions && cd /tmp/kubectl-versions && \
curl -o kubectl1.30 -L https://storage.googleapis.com/kubernetes-release/release/v1.30.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.29 -L https://storage.googleapis.com/kubernetes-release/release/v1.29.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.28 -L https://storage.googleapis.com/kubernetes-release/release/v1.28.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.27 -L https://storage.googleapis.com/kubernetes-release/release/v1.27.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.26 -L https://storage.googleapis.com/kubernetes-release/release/v1.26.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.25 -L https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.24 -L https://storage.googleapis.com/kubernetes-release/release/v1.24.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.23 -L https://storage.googleapis.com/kubernetes-release/release/v1.23.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.22 -L https://storage.googleapis.com/kubernetes-release/release/v1.22.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.21 -L https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/${ARCH}/kubectl && \
Expand All @@ -21,14 +28,20 @@ RUN export ARCH=$([[ "$(uname -m)" == "aarch64" ]] && echo "arm64" || echo "amd6
curl -o kubectl1.6 -L https://storage.googleapis.com/kubernetes-release/release/v1.6.0/bin/linux/${ARCH}/kubectl


FROM debian:bullseye-slim
FROM debian:bookworm-20240812-slim

RUN apt-get update -y && apt-get install busybox -y && ln -s /bin/busybox /usr/bin/[[
RUN apt-get update -y
# install busybox by building source until it's unavailable by apt-get for v1.36.1 ad no need to link [[
RUN apt-get install --no-install-recommends wget build-essential -y && \
wget --no-check-certificate https://busybox.net/downloads/busybox-1.36.1.tar.bz2 && \
tar -xvjf busybox-1.36.1.tar.bz2 && \
cd busybox-1.36.1 && \
make defconfig && \
make && \
make CONFIG_PREFIX="/" install

RUN adduser --gecos "" --disabled-password --home /home/cfu --shell /bin/bash cfu

#RUN apt update && apt upgrade && apt install bash # THIS IS NOT REQUIRED. BASH IS ALREADY INCLUDED IN BULLSEYE

#copy all versions of kubectl to switch between them later.
COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/* /usr/local/bin/
COPY --chown=cfu --chmod=775 --from=builder /tmp/kubectl-versions/kubectl1.10 /usr/local/bin/kubectl
Expand Down
28 changes: 0 additions & 28 deletions Dockerfile.aarch64

This file was deleted.

18 changes: 16 additions & 2 deletions cf-deploy-kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ else
SERVER_VERSION=$(kubectl version --short=true --context "${KUBECONTEXT}" | grep -i server | cut -d ':' -f2 | cut -d '.' -f2 | sed 's/[^0-9]*//g')
echo "Server minor version: $SERVER_VERSION"
if (( "$SERVER_VERSION" <= "6" )); then cp -f /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" <= "7" )); then cp -f /usr/local/bin/kubectl1.7 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" <= "8" )); then cp -f /usr/local/bin/kubectl1.8 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" <= "9" )); then cp -f /usr/local/bin/kubectl1.9 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" <= "10" )); then cp -f /usr/local/bin/kubectl1.10 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" <= "11" )); then cp -f /usr/local/bin/kubectl1.11 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" <= "12" )); then cp -f /usr/local/bin/kubectl1.12 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" <= "13" )); then cp -f /usr/local/bin/kubectl1.13 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" == "14" )); then cp -f /usr/local/bin/kubectl1.14 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" == "15" )); then cp -f /usr/local/bin/kubectl1.15 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" == "16" )); then cp -f /usr/local/bin/kubectl1.16 /usr/local/bin/kubectl; fi 2>/dev/null
Expand All @@ -59,7 +66,14 @@ else
if (( "$SERVER_VERSION" == "20" )); then cp -f /usr/local/bin/kubectl1.20 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" == "21" )); then cp -f /usr/local/bin/kubectl1.21 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" == "22" )); then cp -f /usr/local/bin/kubectl1.22 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "23" )); then cp -f /usr/local/bin/kubectl1.23 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" == "23" )); then cp -f /usr/local/bin/kubectl1.23 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "24" )); then cp -f /usr/local/bin/kubectl1.24 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "25" )); then cp -f /usr/local/bin/kubectl1.25 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "26" )); then cp -f /usr/local/bin/kubectl1.26 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "27" )); then cp -f /usr/local/bin/kubectl1.27 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "28" )); then cp -f /usr/local/bin/kubectl1.28 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "29" )); then cp -f /usr/local/bin/kubectl1.29 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "30" )); then cp -f /usr/local/bin/kubectl1.30 /usr/local/bin/kubectl; fi 2>/dev/null
[ ! -f "${deployment_file}" ] && echo "Couldn't find $deployment_file file at $(pwd)" && exit 1;
fi

Expand Down Expand Up @@ -114,4 +128,4 @@ kubectl --context "${KUBECONTEXT}" --namespace "${KUBERNETES_NAMESPACE}" $KUBECT
if [ -n "$DEPLOYMENT_NAME" ]; then
echo "---> Waiting for a successful deployment/${DEPLOYMENT_NAME} status to namespace ${KUBERNETES_NAMESPACE} ..."
timeout -s SIGTERM $KUBERNETES_DEPLOYMENT_TIMEOUT kubectl --context "${KUBECONTEXT}" --namespace "${KUBERNETES_NAMESPACE}" rollout status deployment/"${DEPLOYMENT_NAME}" || fatal "Deployment Failed"
fi
fi
2 changes: 1 addition & 1 deletion service.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 16.2.6
version: 16.2.7

0 comments on commit 97f2400

Please sign in to comment.