-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying multi stage builds maybe properly
- Loading branch information
Dylan Storey
committed
Aug 6, 2024
1 parent
af444a3
commit 9ae8b98
Showing
2 changed files
with
35 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,40 @@ | ||
FROM derailed/k9s:v0.32.4 AS k9s | ||
FROM --platform=${BUILDPLATFORM} tsl0922/ttyd:latest as ttyd | ||
ARG TARGETPLATFORM | ||
ARG KUBECTL_VERSION="v1.29.0" | ||
|
||
# Install necessary packages | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
wget \ | ||
git \ | ||
apt-transport-https \ | ||
gnupg2 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
# linux/amd64, linux/arm64, linux/x86_64,linux/arm64/v8 | ||
# Install k9s | ||
RUN case ${TARGETPLATFORM} in \ | ||
"linux/amd64") K9S_ARCH=amd64 ;; \ | ||
"linux/arm64") K9S_ARCH=arm64 ;; \ | ||
"linux/arm/v7") K9S_ARCH=armv7 ;; \ | ||
esac \ | ||
&& wget https://github.com/derailed/k9s/releases/download/v0.32.5/k9s_Linux_${K9S_ARCH}.tar.gz \ | ||
&& tar -xzf k9s_Linux_${K9S_ARCH}.tar.gz \ | ||
&& mv k9s /usr/local/bin/ \ | ||
&& rm k9s_Linux_arm64.tar.gz | ||
|
||
# Install kubectl | ||
RUN TARGET_ARCH=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) \ | ||
&& curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${TARGET_ARCH}/kubectl -o /usr/local/bin/kubectl \ | ||
&& chmod +x /usr/local/bin/kubectl | ||
|
||
|
||
|
||
FROM tsl0922/ttyd:alpine | ||
COPY --from=k9s /bin/k9s /bin/k9s | ||
COPY --from=k9s /usr/local/bin/kubectl /usr/local/bin/kubectl | ||
|
||
# Create .kube directory | ||
RUN mkdir -p /root/.kube | ||
|
||
# Set working directory | ||
WORKDIR /root | ||
|
||
# Start ttyd with k9s | ||
CMD ["ttyd", "--writable", "/bin/k9s"] | ||
CMD ["ttyd", "--writable", "k9s"] |