Skip to content

Commit

Permalink
Remove Kubernetes SHIM image
Browse files Browse the repository at this point in the history
  • Loading branch information
adalundhe committed Feb 10, 2024
1 parent 3e5c1b2 commit 90fb220
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 84 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,46 @@ jobs:
build-args: |
VERSION=${{matrix.golang_version}}
BASE=${{env.IMAGE_OS}}
build_variant_kubernetes:
strategy:
matrix:
language_and_version: [
"python-3.10",
"python-3.11",
"python-3.12",
"node-20",
"node-21",
"golang-1.20",
"golang-1.21",
"golang-1.22"
]
env:
REGISTRY: corpheus91/devcontainers
IMAGE_OS: "bookworm"
runs-on: ubuntu-latest
needs: [
build_core_python,
build_core_node,
build_core_golang
]
steps:
- uses: actions/checkout@master
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
file: kubernetes/Dockerfile.kubernetes
tags: corpheus91/devcontainers:${{matrix.language_and_version}}-kubernetes
build-args: |
IMAGE=${{env.REGISTRY}}:${{matrix.language_and_version}}-${{env.IMAGE_OS}}
30 changes: 2 additions & 28 deletions golang/Dockerfile.golang
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ ARG USERNAME=vscode
ARG USER_UID=5000
ARG USER_GID=$USER_UID

ENV DOCKER_BUILDKIT=1 \
PATH=$PATH:/usr/local/go/bin \
TERM=xterm-256color

RUN apt update -y && apt install -y \
sudo curl git build-essential gpg

Expand All @@ -33,31 +29,9 @@ RUN groupadd --gid $USER_GID $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

COPY resources/*.sh /tmp/library-scripts/
COPY resources/common_debian.sh /tmp/library-scripts/common_debian.sh

RUN apt clean \
&& apt update \
&& bash /tmp/library-scripts/common_debian.sh "true" "${USERNAME}" "${USER_UID}" "${USER_GID}" "true" "true" "true" \
&& /bin/bash /tmp/library-scripts/docker-debian.sh "true" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" "true" \
&& /bin/bash /tmp/library-scripts/kubectl-helm-debian.sh "latest" "latest" "none" \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/

# Script copies localhost's ~/.kube/config file into the container and swaps out
# localhost for host.docker.internal on bash/zsh start to keep them in sync.
COPY resources/copy-kube-config.sh /usr/local/share/
RUN chown ${USERNAME}:root /usr/local/share/copy-kube-config.sh \
&& echo "source /usr/local/share/copy-kube-config.sh" | tee -a /root/.bashrc /root/.zshrc /home/${USERNAME}/.bashrc >> /home/${USERNAME}/.zshrc

# [Optional] Uncomment this section to install additional OS packages.
RUN apt update \
&& apt -y install --no-install-recommends kubectx make wget

COPY resources/install_k9s.sh ./install_k9s.sh

RUN /bin/bash install_k9s.sh

# Setting the ENTRYPOINT to docker-init.sh will configure non-root access to
# the Docker socket if "overrideCommand": false is set in devcontainer.json.
# The script will also execute CMD if you need to alter startup behaviors.
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD ["sleep", "infinity" ]
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/
42 changes: 42 additions & 0 deletions kubernetes/Dockerfile.kubernetes
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Note: You can use any Debian/Ubuntu based image you want.
ARG IMAGE
FROM ${IMAGE}
# Enable new "BUILDKIT" mode for Docker CLI
ENV DOCKER_BUILDKIT=1 \
PATH=$PATH:/usr/local/go/bin \
TERM=xterm-256color

# Options
ARG INSTALL_ZSH="true"
ARG UPGRADE_PACKAGES="false"
ARG USE_MOBY="true"
ARG USERNAME=vscode
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
COPY kubernetes/library-scripts/*.sh /tmp/library-scripts/

RUN apt-get clean \
&& apt-get update \
&& /bin/bash /tmp/library-scripts/docker-debian.sh "true" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" "true" \
&& /bin/bash /tmp/library-scripts/kubectl-helm-debian.sh "latest" "latest" "none" \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/

# Script copies localhost's ~/.kube/config file into the container and swaps out
# localhost for host.docker.internal on bash/zsh start to keep them in sync.
COPY resources/copy-kube-config.sh /usr/local/share/
RUN chown ${USERNAME}:root /usr/local/share/copy-kube-config.sh \
&& echo "source /usr/local/share/copy-kube-config.sh" | tee -a /root/.bashrc /root/.zshrc /home/${USERNAME}/.bashrc >> /home/${USERNAME}/.zshrc

# [Optional] Uncomment this section to install additional OS packages.
RUN apt update \
&& apt -y install --no-install-recommends kubectx make wget

COPY resources/install_k9s.sh ./install_k9s.sh

RUN /bin/bash install_k9s.sh

# Setting the ENTRYPOINT to docker-init.sh will configure non-root access to
# the Docker socket if "overrideCommand": false is set in devcontainer.json.
# The script will also execute CMD if you need to alter startup behaviors.
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD ["sleep", "infinity" ]

31 changes: 2 additions & 29 deletions node/Dockerfile.node
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ ARG USERNAME=vscode
ARG USER_UID=5000
ARG USER_GID=$USER_UID

ENV DOCKER_BUILDKIT=1 \
PATH=$PATH:/usr/local/go/bin \
TERM=xterm-256color


RUN apt update -y && apt install -y \
sudo curl git build-essential gpg

Expand All @@ -38,31 +33,9 @@ RUN groupadd --gid $USER_GID $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

COPY resources/*.sh /tmp/library-scripts/
COPY resources/common_debian.sh /tmp/library-scripts/common_debian.sh

RUN apt clean \
&& apt update \
&& bash /tmp/library-scripts/common_debian.sh "true" "${USERNAME}" "${USER_UID}" "${USER_GID}" "true" "true" "true" \
&& /bin/bash /tmp/library-scripts/docker-debian.sh "true" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" "true" \
&& /bin/bash /tmp/library-scripts/kubectl-helm-debian.sh "latest" "latest" "none" \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/

# Script copies localhost's ~/.kube/config file into the container and swaps out
# localhost for host.docker.internal on bash/zsh start to keep them in sync.
COPY resources/copy-kube-config.sh /usr/local/share/
RUN chown ${USERNAME}:root /usr/local/share/copy-kube-config.sh \
&& echo "source /usr/local/share/copy-kube-config.sh" | tee -a /root/.bashrc /root/.zshrc /home/${USERNAME}/.bashrc >> /home/${USERNAME}/.zshrc

# [Optional] Uncomment this section to install additional OS packages.
RUN apt update \
&& apt -y install --no-install-recommends kubectx make wget

COPY resources/install_k9s.sh ./install_k9s.sh

RUN /bin/bash install_k9s.sh

# Setting the ENTRYPOINT to docker-init.sh will configure non-root access to
# the Docker socket if "overrideCommand": false is set in devcontainer.json.
# The script will also execute CMD if you need to alter startup behaviors.
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD ["sleep", "infinity" ]
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/
29 changes: 2 additions & 27 deletions python/Dockerfile.python
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR='/tmp/poetry_cache' \
DOCKER_BUILDKIT=1 \
PATH=$PATH:/usr/local/go/bin \
TERM=xterm-256color
POETRY_CACHE_DIR='/tmp/poetry_cache'

RUN apt update -y && apt install -y \
sudo curl git build-essential gpg
Expand All @@ -40,31 +37,9 @@ RUN groupadd --gid $USER_GID $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

COPY resources/*.sh /tmp/library-scripts/
COPY resources/common_debian.sh /tmp/library-scripts/common_debian.sh

RUN apt clean \
&& apt update \
&& bash /tmp/library-scripts/common_debian.sh "true" "${USERNAME}" "${USER_UID}" "${USER_GID}" "true" "true" "true" \
&& /bin/bash /tmp/library-scripts/docker-debian.sh "true" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" "true" \
&& /bin/bash /tmp/library-scripts/kubectl-helm-debian.sh "latest" "latest" "none" \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/

# Script copies localhost's ~/.kube/config file into the container and swaps out
# localhost for host.docker.internal on bash/zsh start to keep them in sync.
COPY resources/copy-kube-config.sh /usr/local/share/
RUN chown ${USERNAME}:root /usr/local/share/copy-kube-config.sh \
&& echo "source /usr/local/share/copy-kube-config.sh" | tee -a /root/.bashrc /root/.zshrc /home/${USERNAME}/.bashrc >> /home/${USERNAME}/.zshrc

# [Optional] Uncomment this section to install additional OS packages.
RUN apt update \
&& apt -y install --no-install-recommends kubectx make wget

COPY resources/install_k9s.sh ./install_k9s.sh

RUN /bin/bash install_k9s.sh

# Setting the ENTRYPOINT to docker-init.sh will configure non-root access to
# the Docker socket if "overrideCommand": false is set in devcontainer.json.
# The script will also execute CMD if you need to alter startup behaviors.
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD ["sleep", "infinity" ]

0 comments on commit 90fb220

Please sign in to comment.