From ae58ac6a6c47d5b0b50f8efbc34dc5043cc884c4 Mon Sep 17 00:00:00 2001 From: Deluan Date: Tue, 1 Dec 2020 17:57:29 +0000 Subject: [PATCH] Add configuration for VSCode's Remote Container development --- .devcontainer/Dockerfile | 20 +++++++++++ .devcontainer/devcontainer.json | 59 +++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..4d8c7140 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,20 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/go/.devcontainer/base.Dockerfile + +# [Choice] Go version: 1, 1.15, 1.14 +ARG VARIANT="1" +FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} + +# [Option] Install Node.js +ARG INSTALL_NODE="true" +ARG NODE_VERSION="lts/*" +RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Optional] Uncomment this section to install additional OS packages. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends libtag1-dev ffmpeg + +# [Optional] Uncomment the next line to use go get to install anything else you need +# RUN go get -x + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..06cc0e47 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,59 @@ +{ + "name": "Go", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update the VARIANT arg to pick a version of Go: 1, 1.15, 1.14 + "VARIANT": "1.15", + // Options + "INSTALL_NODE": "true", + "NODE_VERSION": "v14" + } + }, + "runArgs": [ + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined" + ], + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "go.useGoProxyToCheckForToolUpdates": false, + "go.useLanguageServer": true, + "go.gopath": "/go", + "go.goroot": "/usr/local/go", + "go.toolsGopath": "/go/bin", + "go.formatTool": "goimports", + "go.lintOnSave": "package", + "go.lintTool": "golangci-lint", + "editor.formatOnSave": true, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "vscode.json-language-features" + } + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "golang.Go", + "esbenp.prettier-vscode", + "tamasfe.even-better-toml" + ], + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 4533, + 4633 + ], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "make setup-dev", + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "remoteEnv": { + "ND_MUSICFOLDER": "./music", + "ND_DATAFOLDER": "./data" + } +} \ No newline at end of file