Skip to content

Commit

Permalink
adding devcontainer files (#232)
Browse files Browse the repository at this point in the history
* adding devcontainer files

Signed-off-by: Aaron Schlesinger <[email protected]>

* bumping Go version to 1.17

Signed-off-by: Aaron Schlesinger <[email protected]>

Co-authored-by: Tom Kerkhove <[email protected]>
  • Loading branch information
arschles and tomkerkhove authored Oct 4, 2021
1 parent cdb8cad commit 40a5c41
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .devcontainer/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// inspired from
// https://github.com/microsoft/vscode-dev-containers/blob/main/containers/go/.devcontainer/devcontainer.json
{
"name": "Go",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go: 1, 1.16, 1.15
"VARIANT": "1.16",
}
},
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Set *default* container specific settings.json values on container create.
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
41 changes: 41 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# [Choice] Go version: 1, 1.16, 1.15
ARG VARIANT=1.17
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}

# install mage
RUN git clone https://github.com/magefile/mage && \
cd mage && \
go run bootstrap.go && \
cd .. && \
rm -rf mage

# install helm
RUN curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

# install k9s
RUN curl -L -o k9s.tgz https://github.com/derailed/k9s/releases/download/v0.24.15/k9s_Linux_x86_64.tar.gz && \
tar -xzf k9s.tgz && \
mv k9s /usr/local/bin/k9s && \
rm k9s.tgz

# install kubebuilder / controller-gen
RUN curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/$(go env GOOS)/$(go env GOARCH) && \
chmod +x kubebuilder && mv kubebuilder /usr/local/bin/

# install kubectl
RUN apt-get update && \
apt-get install -y apt-transport-https ca-certificates curl && \
sudo 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 && \
sudo apt-get update && \
sudo apt-get install -y kubectl

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment the next line to use go get to install anything else you need
# RUN go get -x <your-dependency-or-tool>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

0 comments on commit 40a5c41

Please sign in to comment.