-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add devcontaioner and related Dockerfile (#66)
* Update: improvements to rootCommand and versionCmd Signed-off-by: Santosh Kaluskar <[email protected]> * chore: adds devcontainer and Dockerfile for the project Signed-off-by: Santosh Kaluskar <[email protected]> --------- Signed-off-by: Santosh Kaluskar <[email protected]>
- Loading branch information
1 parent
c469263
commit a3030f0
Showing
10 changed files
with
161 additions
and
36 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,26 @@ | ||
ARG GO_VERSION=1.22 | ||
FROM golang:${GO_VERSION}-bullseye | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=1000 | ||
RUN apt-get update -y | ||
RUN apt-get install python3 && ln -sf python3 /usr/bin/pyppthon | ||
RUN apt-get install python3-pip -y \ | ||
&& apt-get install -y sudo \ | ||
vim \ | ||
make | ||
RUN pip3 install --no-cache --upgrade pip setuptools | ||
RUN pip install pre-commit | ||
|
||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
&& echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
||
RUN apt install wget git make | ||
RUN wget https://github.com/sigstore/gitsign/releases/download/v0.10.1/gitsign_0.10.1_linux_amd64 && \ | ||
chmod +x gitsign_0.10.1_linux_amd64 && \ | ||
mv ./gitsign_0.10.1_linux_amd64 /usr/bin/gitsign | ||
|
||
# Setup shell | ||
USER vscode |
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,98 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/go | ||
{ | ||
"name": "Go", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
|
||
"build":{ | ||
"dockerfile": "Dockerfile", | ||
"context": ".." | ||
}, | ||
"containerEnv": { | ||
"SHELL": "/bin/bash" | ||
}, | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": { | ||
// "ghcr.io/devcontainers-contrib/features/gitsign:1": {} | ||
// }, | ||
|
||
// 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 mod tidy && pre-commit install", | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
"settings": { | ||
"eamodio.gitlens":["ui"], | ||
"files.eol": "\n", | ||
"remote.extensionKind": { | ||
"ms-azuretools.vscode-docker": "workspace" | ||
}, | ||
"editor.codeActionsOnSaveTimeout": 3000, | ||
"go.useLanguageServer": true, | ||
"[go]": { | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
}, | ||
// Optional: Disable snippets, as they conflict with completion ranking. | ||
// "editor.snippetSuggestions": "none" | ||
}, | ||
"[go.mod]": { | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
} | ||
}, | ||
"gopls": { | ||
"usePlaceholders": false, | ||
"staticcheck": true | ||
}, | ||
"go.autocompleteUnimportedPackages": true, | ||
"go.gotoSymbol.includeImports": true, | ||
"go.gotoSymbol.includeGoroot": true, | ||
"go.lintTool": "golangci-lint", | ||
"go.buildOnSave": "workspace", | ||
"go.lintOnSave": "workspace", | ||
"go.vetOnSave": "workspace", | ||
"editor.formatOnSave": true, | ||
"go.toolsEnvVars": { | ||
"GOFLAGS": "-tags=" | ||
// "CGO_ENABLED": 1 // for the race detector | ||
}, | ||
"gopls.env": { | ||
"GOFLAGS": "-tags=" | ||
}, | ||
"go.testEnvVars": { | ||
"": "" | ||
}, | ||
"go.testFlags": ["-v", "-race"], | ||
"go.testTimeout": "10s", | ||
"go.coverOnSingleTest": true, | ||
"go.coverOnSingleTestFile": true | ||
}, | ||
|
||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"go.toolsManagement.checkForUpdates": "local", | ||
"go.useLanguageServer": true, | ||
"go.gopath": "/go" | ||
|
||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"golang.Go", | ||
"ms-azuretools.vscode-docker", | ||
"eamodio.gitlens" | ||
] | ||
} | ||
}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
"remoteUser": "vscode" | ||
} |
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 |
---|---|---|
|
@@ -9,4 +9,4 @@ Dockerfile* | |
genval | ||
cosign | ||
.todo | ||
|
||
!.devcontainer/Dockerfile |
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
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
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
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