-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: running locally through dev container (#8677)
* test: test Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * docs: add dev-container notes Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: removed unused devcontainer feature Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: move devcontainer features kubectl/git to DOCKERFILE, siwtch to bullseye variant Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: rephrase sentence according to comments Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: add k3d start wait according to comments Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: spell check dictionary Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: add running locally timings Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: use Home/go as GOPATH due mac doesnt support write at root level Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: doc apple silicon typo Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: set kube/config post k3d creation Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: move features to DOCKERFILE and pin versions Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * fix: chown on GOPATH instead of ~, ~ in mac starts from Users instead of home, this can cause issues Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * docs: add running-locally linux notes Signed-off-by: Tianchu Zhao <evantczhao@gmail.com> * docs: running-locally, update manual setup time Signed-off-by: Tianchu Zhao <evantczhao@gmail.com>
- Loading branch information
Showing
5 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/debian/.devcontainer/base.Dockerfile | ||
|
||
ARG VARIANT="bullseye" | ||
FROM --platform=linux/amd64 mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} | ||
|
||
ARG NEW_USERNAME="" | ||
ARG HOME="" | ||
ARG OLD_USERNAME="vscode" | ||
ARG VSCODE_SCRIPT_VERSION="" | ||
|
||
ARG PROTOC_ZIP="protoc-3.14.0-linux-x86_64.zip" | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get install -y apt-transport-https ca-certificates git sudo \ | ||
# use new user instead of vscode user | ||
&& usermod -l $NEW_USERNAME -d /home/$NEW_USERNAME -m $OLD_USERNAME \ | ||
&& groupmod -n $NEW_USERNAME $OLD_USERNAME \ | ||
&& echo $NEW_USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$NEW_USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$NEW_USERNAME \ | ||
# kubectl | ||
&& curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg \ | ||
&& echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list \ | ||
&& apt-get update \ | ||
&& apt-get install -y kubectl \ | ||
# protobuf | ||
&& curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/${PROTOC_ZIP} \ | ||
&& unzip -o ${PROTOC_ZIP} -d /usr/local bin/protoc \ | ||
&& unzip -o ${PROTOC_ZIP} -d /usr/local 'include/*' \ | ||
&& rm -f ${PROTOC_ZIP} \ | ||
&& chmod 755 /usr/local/bin/protoc \ | ||
&& chmod -R 755 /usr/local/include/ \ | ||
# k3d | ||
&& wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash \ | ||
# go | ||
&& bash -ec "$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/$VSCODE_SCRIPT_VERSION/script-library/go-debian.sh")" -- "1.18" "/usr/local/go" "$HOME/go" "automatic" "true" "false" \ | ||
# dind | ||
&& bash -ec "$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/$VSCODE_SCRIPT_VERSION/script-library/docker-in-docker-debian.sh")" -- "true" "automatic" "true" "20.10" "v1" \ | ||
# node | ||
&& bash -ec "$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/$VSCODE_SCRIPT_VERSION/script-library/node-debian.sh")" -- "/usr/local/share/nvm" "16" "automatic" "true" "true" \ | ||
# python | ||
&& bash -ec "$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/$VSCODE_SCRIPT_VERSION/script-library/python-debian.sh")" -- "3.9" \ | ||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/debian | ||
{ | ||
"name": "Debian", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
"VARIANT": "bullseye", | ||
"NEW_USERNAME": "${localEnv:USER}", | ||
"HOME": "${localEnv:HOME}", | ||
"VSCODE_SCRIPT_VERSION": "v0.234.0" | ||
} | ||
}, | ||
|
||
"settings": {}, | ||
|
||
"extensions": [], | ||
|
||
"mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], | ||
|
||
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], | ||
|
||
"remoteUser": "${localEnv:USER}", | ||
"features": {}, | ||
|
||
"workspaceMount": "source=${localWorkspaceFolder},target=${localEnv:HOME}/go/src/github.com/argoproj/argo-workflows,type=bind", | ||
"workspaceFolder": "${localEnv:HOME}/go/src/github.com/argoproj/argo-workflows", | ||
|
||
"postCreateCommand": "bash -i .devcontainer/startup.sh" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
sudo apt update | ||
sudo chown $USER:docker /var/run/docker.sock | ||
sudo chown -fR $USER:golang $GOPATH | ||
|
||
echo '127.0.0.1 dex\n127.0.0.1 minio\n127.0.0.1 postgres\n127.0.0.1 mysql' | sudo tee -a /etc/hosts | ||
|
||
if k3d cluster list | grep k3s-default; | ||
then | ||
echo "skip k3s creation, k3s-default cluster already exist" | ||
else | ||
k3d cluster create | ||
fi | ||
|
||
until k3d cluster start --wait ; do sleep 5 ; done | ||
k3d kubeconfig merge k3s-default --kubeconfig-merge-default --kubeconfig-switch-context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters