From 5a0034504c7c283b4eeed04d2ca68d436bf1ad0d Mon Sep 17 00:00:00 2001 From: Nicholas Morey Date: Thu, 9 May 2024 14:54:48 -0400 Subject: [PATCH] feat: add k3d to devcontainer (#5) Signed-off-by: Nicholas Morey --- .github/workflows/build.yaml | 34 +++++++++++++++++++++ .github/workflows/push-container-image.yaml | 4 ++- containers/akuity-devcontainer/Dockerfile | 13 +++++--- 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..32bf403 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,34 @@ +name: Build + +on: + workflow_dispatch: + inputs: + container: + description: 'The container to push' + required: true + default: 'akuity-devcontainer' + type: choice + options: # Folders under `containers/` that have a repo set up in Quay. + - akuity-devcontainer + - guestbook + - leaderboard + +run-name: Build ${{ inputs.container }}:${{ inputs.tag }} + +jobs: + push-container-image: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: 'containers/${{ inputs.container }}' + push: false + tags: quay.io/akuity/argo-cd-learning-assets/${{ inputs.container }}:pr-${{ github.event.pull_request.number }} + platforms: 'linux/amd64,linux/arm64' \ No newline at end of file diff --git a/.github/workflows/push-container-image.yaml b/.github/workflows/push-container-image.yaml index 036b98e..1dee473 100644 --- a/.github/workflows/push-container-image.yaml +++ b/.github/workflows/push-container-image.yaml @@ -1,10 +1,12 @@ +name: Push + on: workflow_dispatch: inputs: container: description: 'The container to push' required: true - default: 'leaderboard' + default: 'akuity-devcontainer' type: choice options: # Folders under `containers/` that have a repo set up in Quay. - akuity-devcontainer diff --git a/containers/akuity-devcontainer/Dockerfile b/containers/akuity-devcontainer/Dockerfile index 3ed073d..22cb95b 100644 --- a/containers/akuity-devcontainer/Dockerfile +++ b/containers/akuity-devcontainer/Dockerfile @@ -1,6 +1,11 @@ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu/.devcontainer/base.Dockerfile FROM mcr.microsoft.com/vscode/devcontainers/base:0-ubuntu-22.04 +# Run the things we need +RUN apt update && apt install bash-completion && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + # Select desired version for each tool ENV ARGOCD_VERSION=v2.10.9 RUN curl -sSL -o /usr/local/bin/argocd "https://github.com/argoproj/argo-cd/releases/download/${ARGOCD_VERSION}/argocd-linux-amd64" \ @@ -29,6 +34,9 @@ RUN curl -Lo /usr/local/bin/kind https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kin && chmod +x /usr/local/bin/kind \ && echo 'source <(kind completion bash)' >> /usr/share/bash-completion/completions/kind +ENV K3D_VERSION=v5.6.3 +RUN wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/${K3D_VERSION}/install.sh | bash + # This should be the same K8s version that kind creates. ENV KUBECTL_VERSION=v1.29.3 RUN curl -Lo /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \ @@ -69,11 +77,6 @@ RUN curl -Lo /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/downloa && chmod +x /usr/local/bin/yq \ && echo 'source <(yq shell-completion bash)' >> /usr/share/bash-completion/completions/yq -# Run the things we need -RUN apt update && apt install bash-completion && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - # Add aliases and such RUN echo 'source /etc/profile.d/bash_completion.sh' >> /etc/bash.bashrc \ && echo 'alias k="kubectl"' >> /etc/bash.bashrc \