Skip to content

Commit

Permalink
dev: Use the common linkerd devcontainer image (kubernetes#1465)
Browse files Browse the repository at this point in the history
This repo's devcontainer runs everything as root, which can lead to
weird permissions, especially in the `.git/` directory.

This change replaces the repo-specific devcontainer with the general
`linkerd/dev` container. Custom tools like `hugo`, `htmltest`, and
`gcloud` are installed via an on-create script.

Signed-off-by: Oliver Gould <ver@buoyant.io>
  • Loading branch information
olix0r authored Aug 25, 2022
1 parent b008977 commit 38187d1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 33 deletions.
28 changes: 21 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{
"name": "website",
//"image": "buoyantio/website-builder:v1.3.3",
"build": {
"dockerfile": "../Dockerfile"
},
// "context": "..",
"name": "linkerd-website",
"image": "ghcr.io/linkerd/dev:v30",
"onCreateCommand": ".devcontainer/on-create.sh",
"extensions": [
"DavidAnson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"budparr.language-hugo-vscode",
"NathanRidley.autotrim",
"redhat.vscode-yaml",
"samverschueren.final-newline",
"tamasfe.even-better-toml"
],
"runArgs": [
"--init",
// Limit container memory usage.
"--memory=4g",
"--memory-swap=4g",
// Use the host network so we can access k3d, etc.
"--net=host"
],
"overrideCommand": false,
"remoteUser": "root",
"remoteUser": "code",
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"
]
Expand Down
22 changes: 22 additions & 0 deletions .devcontainer/on-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -euo pipefail

cd $(mktemp -d)

# hugo
scurl -O https://github.com/gohugoio/hugo/releases/download/v0.61.0/hugo_extended_0.61.0_Linux-64bit.deb
sudo dpkg -i hugo*.deb
rm hugo*.deb

# htmltest
scurl https://htmltest.wjdp.uk | bash
sudo mv bin/htmltest /usr/local/bin

# gcloud
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \
| sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
scurl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update
sudo apt-get install google-cloud-cli
26 changes: 0 additions & 26 deletions Dockerfile

This file was deleted.

0 comments on commit 38187d1

Please sign in to comment.