Skip to content

Commit

Permalink
feat: add k3d to devcontainer (#5)
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas Morey <[email protected]>
  • Loading branch information
morey-tech authored May 9, 2024
1 parent 6a6198a commit 5a00345
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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'
4 changes: 3 additions & 1 deletion .github/workflows/push-container-image.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 8 additions & 5 deletions containers/akuity-devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" \
Expand Down Expand Up @@ -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" \
Expand Down Expand Up @@ -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 \
Expand Down

0 comments on commit 5a00345

Please sign in to comment.