-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub supports [dev containers][dc] to describe reproducible development environments (e.g. for use from VS code). This change introduces a devcontainer.json and Dockerfile to support container-based development. This setup configures docker-in-docker so that docker and k3d can be run inside the dev container. This base configuration can be amended with per-user personalizations via a [dotfiles][df] repo. For example: github.com/olix0r/dotfiles. [dc]: https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/configuring-codespaces-for-your-project [df]: https://docs.github.com/en/codespaces/customizing-your-codespace/personalizing-codespaces-for-your-account Signed-off-by: Oliver Gould <ver@buoyant.io>
- Loading branch information
Showing
2 changed files
with
78 additions
and
0 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,49 @@ | ||
FROM docker.io/rust:1.56.1-bullseye | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt update && apt upgrade -y | ||
RUN apt install -y \ | ||
clang \ | ||
cmake \ | ||
golang \ | ||
lldb \ | ||
lsb-release \ | ||
sudo \ | ||
time | ||
|
||
ARG USER=code | ||
ARG USER_UID=1000 | ||
ARG USER_GID=1000 | ||
RUN groupadd --gid=$USER_GID $USER \ | ||
&& useradd --uid=$USER_UID --gid=$USER_GID -m $USER \ | ||
&& echo "$USER ALL=(root) NOPASSWD:ALL" >/etc/sudoers.d/$USER \ | ||
&& chmod 0440 /etc/sudoers.d/$USER | ||
|
||
# Install a Docker client that uses the host's Docker daemon | ||
ARG USE_MOBY=false | ||
ENV DOCKER_BUILDKIT=1 | ||
RUN curl --proto '=https' --tlsv1.3 -vsSfL https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/docker-debian.sh \ | ||
| bash -s -- true /var/run/docker-host.sock /var/run/docker.sock "${USER}" "${USE_MOBY}" latest | ||
|
||
USER $USER | ||
ENV HOME=/home/$USER | ||
RUN mkdir -p $HOME/bin | ||
ENV PATH=$HOME/bin:$PATH | ||
|
||
RUN curl --proto '=https' --tlsv1.3 -vsSfLo $HOME/kubectl "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ | ||
&& chmod 755 $HOME/kubectl | ||
RUN curl --proto '=https' --tlsv1.3 -vsSfL https://raw.githubusercontent.com/rancher/k3d/main/install.sh \ | ||
| USE_SUDO=false K3D_INSTALL_DIR=$HOME/bin bash | ||
|
||
RUN rustup component add clippy rustfmt | ||
RUN mkdir /tmp/cargo-deny && cd /tmp/cargo-deny && \ | ||
curl --proto '=https' --tlsv1.3 -vsSfL https://github.com/EmbarkStudios/cargo-deny/releases/download/0.11.0/cargo-deny-0.11.0-x86_64-unknown-linux-musl.tar.gz \ | ||
| tar zxf - \ | ||
&& mv cargo-deny-0.11.0-x86_64-unknown-linux-musl/cargo-deny $HOME/bin \ | ||
&& cd .. && rm -rf /tmp/cargo-deny | ||
|
||
RUN curl --proto '=https' --tlsv1.3 -vsSfL https://run.linkerd.io/install-edge | sh \ | ||
&& ln -s $(readlink ~/.linkerd2/bin/linkerd) ~/bin/linkerd | ||
|
||
ENTRYPOINT ["/usr/local/share/docker-init.sh"] | ||
CMD ["sleep", "infinity"] |
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,29 @@ | ||
{ | ||
"name": "linkerd2-proxy", | ||
"image": "ghcr.io/linkerd/dev-proxy:v3", | ||
//"dockerFile": "./Dockerfile", | ||
"extensions": [ | ||
"DavidAnson.vscode-markdownlint", | ||
"matklad.rust-analyzer", | ||
"NathanRidley.autotrim", | ||
"samverschueren.final-newline", | ||
"streetsidesoftware.code-spell-checker", | ||
"tamasfe.even-better-toml", | ||
"vadimcn.vscode-lldb", | ||
"zxh404.vscode-proto3" | ||
], | ||
// Support docker + debugger | ||
"runArgs": [ | ||
"--init", | ||
// Use the host network so we can access k3d, etc. | ||
"--net=host", | ||
// For lldb | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt=seccomp=unconfined" | ||
], | ||
"overrideCommand": false, | ||
"remoteUser": "code", | ||
"mounts": [ | ||
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind" | ||
] | ||
} |