Skip to content

Commit 8460738

Browse files
Merge pull request #1 from kforeverisback/feature/k-helm-k3d-script
Add k3d dev container
2 parents e7ce8bd + bf33644 commit 8460738

File tree

10 files changed

+1371
-0
lines changed

10 files changed

+1371
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Note: You can use any Debian/Ubuntu based image you want.
2+
FROM mcr.microsoft.com/vscode/devcontainers/base:0-bullseye
3+
4+
# Enable new "BUILDKIT" mode for Docker CLI
5+
ENV DOCKER_BUILDKIT=1
6+
7+
# Options
8+
ARG INSTALL_ZSH="true"
9+
ARG UPGRADE_PACKAGES="false"
10+
ARG USE_MOBY="true"
11+
ARG USERNAME=vscode
12+
ARG USER_UID=1000
13+
ARG USER_GID=$USER_UID
14+
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
15+
COPY library-scripts/*.sh /tmp/library-scripts/
16+
RUN apt-get update && /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
17+
&& /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh "true" "${USERNAME}" "${USE_MOBY}" \
18+
&& /bin/bash /tmp/library-scripts/kubectl-helm-debian.sh "latest" "latest" "latest" \
19+
&& mkdir -p $HOME/.k3d \
20+
&& chown ${USERNAME} $HOME/.k3d \
21+
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/
22+
23+
VOLUME [ "/var/lib/docker" ]
24+
25+
# Setting the ENTRYPOINT to docker-init.sh will start up the Docker Engine
26+
# inside the container "overrideCommand": false is set in devcontainer.json.
27+
# The script will also execute CMD if you need to alter startup behaviors.
28+
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
29+
CMD [ "sleep", "infinity" ]
30+
31+
# [Optional] Uncomment this section to install additional OS packages.
32+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
33+
# && apt-get -y install --no-install-recommends <your-package-list-here>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Kubernetes - k3d-in-Docker",
3+
"dockerFile": "Dockerfile",
4+
"runArgs": ["--privileged"],
5+
"mounts": [
6+
"source=k3d-var-lib-docker,target=/var/lib/docker,type=volume",
7+
"source=k3d-config,target=/home/${remoteUser}/.k3d,type=volume"
8+
],
9+
"overrideCommand": false,
10+
11+
// Set *default* container specific settings.json values on container create.
12+
"settings": {},
13+
14+
// Add the IDs of extensions you want installed when the container is created.
15+
"extensions": [
16+
"ms-azuretools.vscode-docker",
17+
"ms-kubernetes-tools.vscode-kubernetes-tools"
18+
],
19+
20+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
21+
// "forwardPorts": [],
22+
23+
// Use 'postCreateCommand' to run commands after the container is created.
24+
// "postCreateCommand": "kubectl version --client=true --output=yaml",
25+
26+
// Use 'postStartCommand' to run commands after the container is created like starting k3d.
27+
// "postStartCommand": "k3d cluster create > k3d.log 2>&1",
28+
29+
// k3d does not like running as root, so use a non-root user.
30+
"remoteUser": "vscode"
31+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Warning: Folder contents may be replaced
2+
3+
The contents of this folder will be automatically replaced with a file of the same name in the repository's [script-library folder](https://github.com/microsoft/vscode-dev-containers/tree/main/script-library) whenever the repository is packaged.
4+
5+
To retain your edits, move the file to a different location. You may also delete the files if they are not needed.

0 commit comments

Comments
 (0)