Skip to content

Commit

Permalink
backport enhancements from Kargo dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
usrbinkat committed Aug 24, 2024
1 parent 82136b1 commit 35967a9
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 115 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
with:
string: ${{ github.repository }}

- name: Build and Push Image pulumi/devcontainer:slim
- name: Build and Push Image devcontainer:slim
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -83,7 +83,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:slim,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:slim-node
- name: Build and Push Image devcontainer:slim-node
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -96,7 +96,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:slim-node,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:slim-python
- name: Build and Push Image devcontainer:slim-python
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -109,7 +109,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:slim-python,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:slim-golang
- name: Build and Push Image devcontainer:slim-golang
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -122,7 +122,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:slim-dotnet,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:slim-dotnet
- name: Build and Push Image devcontainer:slim-dotnet
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -135,7 +135,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:slim-dotnet,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:slim-all
- name: Build and Push Image devcontainer:slim-all
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -148,7 +148,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:slim-all,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:hugo
- name: Build and Push Image devcontainer:hugo
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -161,7 +161,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:hugo,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:base
- name: Build and Push Image devcontainer:base
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -174,7 +174,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:base,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:dind
- name: Build and Push Image devcontainer:dind
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -187,7 +187,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:dind,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:extra
- name: Build and Push Image devcontainer:extra
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand All @@ -200,7 +200,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:extra,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}"

- name: Build and Push Image pulumi/devcontainer:code-server
- name: Build and Push Image devcontainer:code-server
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
with:
Expand Down
178 changes: 90 additions & 88 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ FROM ghcr.io/pulumi/devcontainer:slim-all

# Apt Packages
ARG APT_PKGS="\
bc \
mc \
btop \
pigz \
ripgrep \
tcpdump \
libwrap0 \
neofetch \
"
bc \
mc \
btop \
pigz \
ripgrep \
tcpdump \
libwrap0 \
neofetch \
"

# Apt Packages
RUN echo \
&& export TEST="neofetch" \
&& ${apt_update} \
&& bash -c "${apt_install} --no-install-recommends -o Dpkg::Options::='--force-confold' ${APT_PKGS}" \
&& bash -c "${apt_clean}" \
&& ${dir_clean} \
&& ${TEST} \
&& echo
&& export TEST="neofetch" \
&& ${apt_update} \
&& bash -c "${apt_install} --no-install-recommends -o Dpkg::Options::='--force-confold' ${APT_PKGS}" \
&& bash -c "${apt_clean}" \
&& ${dir_clean} \
&& ${TEST} \
&& echo

#################################################################################
# Image Metadata
Expand All @@ -44,84 +44,86 @@ LABEL tag="base"
# - https://nektosact.com
# - https://github.com/nektos/gh-act
RUN echo \
&& export NAME=act \
&& export TEST="${NAME} --version" \
&& export REPOSITORY="nektos/gh-act" \
&& export VERSION="$(${curl} https://api.github.com/repos/${REPOSITORY}/releases/latest | jq --raw-output .tag_name)" \
&& export ARCH=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \
&& export PKG="linux-${ARCH}" \
&& export URL="https://github.com/${REPOSITORY}/releases/download/${VERSION}/${PKG}" \
&& echo "---------------------------------------------------------"\
&& echo "INFO[${NAME}] Installed:" \
&& echo "INFO[${NAME}] Command: ${NAME}" \
&& echo "INFO[${NAME}] Package: ${PKG}" \
&& echo "INFO[${NAME}] Latest Release: ${VERSION}" \
&& echo "INFO[${NAME}] Architecture: ${ARCH}" \
&& echo "INFO[${NAME}] Source: ${URL}" \
&& echo "---------------------------------------------------------"\
&& ${curl} ${URL} --output /tmp/${NAME} \
&& sudo ${INSTALL} /tmp/${NAME} ${BIN}/${NAME} \
&& ${dir_clean} \
&& ${TEST} \
&& echo
&& export NAME=act \
&& export TEST="${NAME} --version" \
&& export REPOSITORY="nektos/gh-act" \
&& export VERSION="$(${curl} https://api.github.com/repos/${REPOSITORY}/releases/latest | jq --raw-output .tag_name)" \
&& export ARCH=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \
&& export PKG="linux-${ARCH}" \
&& export URL="https://github.com/${REPOSITORY}/releases/download/${VERSION}/${PKG}" \
&& echo "---------------------------------------------------------"\
&& echo "INFO[${NAME}] Installed:" \
&& echo "INFO[${NAME}] Command: ${NAME}" \
&& echo "INFO[${NAME}] Package: ${PKG}" \
&& echo "INFO[${NAME}] Latest Release: ${VERSION}" \
&& echo "INFO[${NAME}] Architecture: ${ARCH}" \
&& echo "INFO[${NAME}] Source: ${URL}" \
&& echo "---------------------------------------------------------"\
&& ${curl} ${URL} --output /tmp/${NAME} \
&& sudo ${INSTALL} /tmp/${NAME} ${BIN}/${NAME} \
&& ${dir_clean} \
&& ${TEST} \
&& echo

# Install Kubectl
# - https://kubernetes.io
# - github.com/kubernetes/kubernetes
RUN echo \
&& export NAME=kubectl \
&& export TEST="${NAME} version --client" \
&& export REPOSITORY="kubernetes/kubernetes" \
&& export VERSION="$(${curl} https://api.github.com/repos/${REPOSITORY}/releases/latest | jq --raw-output .tag_name)" \
&& export ARCH=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \
&& export PKG="${NAME}" \
&& export URL="https://storage.googleapis.com/kubernetes-release/release/${VERSION}/bin/linux/${ARCH}/${PKG}" \
&& echo "---------------------------------------------------------"\
&& echo "INFO[${NAME}] Installed:" \
&& echo "INFO[${NAME}] Command: ${NAME}" \
&& echo "INFO[${NAME}] Package: ${PKG}" \
&& echo "INFO[${NAME}] Latest Release: ${VERSION}" \
&& echo "INFO[${NAME}] Architecture: ${ARCH}" \
&& echo "INFO[${NAME}] Source: ${URL}" \
&& echo "---------------------------------------------------------"\
&& sudo ${curl} ${URL} --output /tmp/${NAME} \
&& sudo ${INSTALL} /tmp/kubectl ${BIN}/${NAME} \
&& ${dir_clean} \
&& ${TEST} \
&& echo
&& export NAME=kubectl \
&& export TEST="${NAME} version --client" \
&& export REPOSITORY="kubernetes/kubernetes" \
&& export VERSION="$(${curl} https://api.github.com/repos/${REPOSITORY}/releases/latest | jq --raw-output .tag_name)" \
&& export ARCH=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \
&& export PKG="${NAME}" \
&& export URL="https://storage.googleapis.com/kubernetes-release/release/${VERSION}/bin/linux/${ARCH}/${PKG}" \
&& echo "---------------------------------------------------------"\
&& echo "INFO[${NAME}] Installed:" \
&& echo "INFO[${NAME}] Command: ${NAME}" \
&& echo "INFO[${NAME}] Package: ${PKG}" \
&& echo "INFO[${NAME}] Latest Release: ${VERSION}" \
&& echo "INFO[${NAME}] Architecture: ${ARCH}" \
&& echo "INFO[${NAME}] Source: ${URL}" \
&& echo "---------------------------------------------------------"\
&& sudo ${curl} ${URL} --output /tmp/${NAME} \
&& sudo ${INSTALL} /tmp/kubectl ${BIN}/${NAME} \
&& ${dir_clean} \
&& ${TEST} \
&& echo

# Install Krew
ARG KREW_PKG="\
view-secret \
view-cert \
open-svc \
whoami \
konfig \
ktop \
neat \
tail \
ctx \
ns \
"
view-utilization \
view-secret \
view-cert \
rook-ceph \
open-svc \
whoami \
konfig \
ktop \
neat \
tail \
ctx \
ns \
"
RUN echo \
&& export NAME=krew \
&& export TEST="kubectl ${NAME} version" \
&& export REPOSITORY="kubernetes-sigs/${NAME}" \
&& export ARCH=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \
&& export VERSION="$(${curl} https://api.github.com/repos/${REPOSITORY}/releases/latest | jq --raw-output .tag_name)" \
&& export PKG="${NAME}-linux_${ARCH}.tar.gz" \
&& export URL="https://github.com/${REPOSITORY}/releases/download/${VERSION}/${PKG}" \
&& echo "---------------------------------------------------------"\
&& echo "INFO[${NAME}] Installed:" \
&& echo "INFO[${NAME}] Command: (kubectl) ${NAME}" \
&& echo "INFO[${NAME}] Package: ${PKG}" \
&& echo "INFO[${NAME}] Latest Release: ${VERSION}" \
&& echo "INFO[${NAME}] Architecture: ${ARCH}" \
&& echo "INFO[${NAME}] Source: ${URL}" \
&& echo "---------------------------------------------------------"\
&& ${curl} ${URL} | tar xzvf - --directory /tmp ./${NAME}-linux_${ARCH} \
&& sudo ${INSTALL} /tmp/${NAME}-linux_${ARCH} ${BIN}/kubectl-${NAME} \
&& for pkg in ${CODE_PKGS}; do kubectl ${NAME} install ${pkg}; echo "Installed: ${pkg}"; done \
&& ${dir_clean} \
&& ${TEST} \
&& echo
&& export NAME=krew \
&& export TEST="kubectl ${NAME} version" \
&& export REPOSITORY="kubernetes-sigs/${NAME}" \
&& export ARCH=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \
&& export VERSION="$(${curl} https://api.github.com/repos/${REPOSITORY}/releases/latest | jq --raw-output .tag_name)" \
&& export PKG="${NAME}-linux_${ARCH}.tar.gz" \
&& export URL="https://github.com/${REPOSITORY}/releases/download/${VERSION}/${PKG}" \
&& echo "---------------------------------------------------------"\
&& echo "INFO[${NAME}] Installed:" \
&& echo "INFO[${NAME}] Command: (kubectl) ${NAME}" \
&& echo "INFO[${NAME}] Package: ${PKG}" \
&& echo "INFO[${NAME}] Latest Release: ${VERSION}" \
&& echo "INFO[${NAME}] Architecture: ${ARCH}" \
&& echo "INFO[${NAME}] Source: ${URL}" \
&& echo "---------------------------------------------------------"\
&& ${curl} ${URL} | tar xzvf - --directory /tmp ./${NAME}-linux_${ARCH} \
&& sudo ${INSTALL} /tmp/${NAME}-linux_${ARCH} ${BIN}/kubectl-${NAME} \
&& for pkg in ${CODE_PKGS}; do kubectl ${NAME} install ${pkg}; echo "Installed: ${pkg}"; done \
&& ${dir_clean} \
&& ${TEST} \
&& echo
7 changes: 3 additions & 4 deletions docker/code-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ RUN set -ex \
ARG CODE_PKGS="\
golang.go \
vscodevim.vim \
stateful.runme \
github.copilot \
max-ss.cyberpunk \
ms-python.python \
Expand All @@ -42,19 +43,17 @@ ARG CODE_PKGS="\
oderwat.indent-rainbow \
okteto.kubernetes-context \
ms-vsliveshare.vsliveshare \
chadonsom.auto-view-readme \
ms-azuretools.vscode-docker \
github.vscode-github-actions \
ms-kubernetes-tools.kind-vscode \
ms-vscode.vscode-typescript-next \
github.vscode-pull-request-github \
matt-rudge.auto-open-preview-panel \
ms-vscode-remote.remote-containers \
bierner.markdown-preview-github-styles \
randomfractalsinc.vscode-data-table \
visualstudioexptteam.vscodeintellicode \
bierner.markdown-preview-github-styles \
ms-kubernetes-tools.vscode-kubernetes-tools \
"

RUN set -ex \
&& for pkg in ${CODE_PKGS}; do code-server --install-extension ${pkg}; echo "Installed: ${pkg}"; done \
&& true
Expand Down
Loading

0 comments on commit 35967a9

Please sign in to comment.