From 1dc048ae40e0d006f83a65af0dbb3c937d622229 Mon Sep 17 00:00:00 2001 From: koudaiii Date: Sat, 23 Apr 2022 21:52:05 +0900 Subject: [PATCH 1/8] Setup to Remote Container Configuration File --- .devcontainer/Dockerfile | 20 ++++++++++++++++ .devcontainer/devcontainer.json | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 62 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 0000000..117984f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,20 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go/.devcontainer/base.Dockerfile + +# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster +ARG VARIANT="1.18-bullseye" +FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} + +# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /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 + +# [Optional] Uncomment the next lines to use go get to install anything else you need +# USER vscode +# 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 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..87c0a98 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,42 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go +{ + "name": "Go", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update the VARIANT arg to pick a version of Go: 1, 1.18, 1.17 + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local arm64/Apple Silicon. + "VARIANT": "1.17", + // Options + "NODE_VERSION": "none" + } + }, + "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" + }, + + // 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 to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "terraform": "0.15", + "azure-cli": "latest" + } +} From fb979adecba5aad52b314434803e9c13ee0f681a Mon Sep 17 00:00:00 2001 From: koudaiii Date: Sat, 23 Apr 2022 21:56:07 +0900 Subject: [PATCH 2/8] Does work the redirect after 'az login'. --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 87c0a98..440e5b8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -28,7 +28,7 @@ ], // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], + "forwardPorts": [45883], // Use 'postCreateCommand' to run commands after the container is created. // "postCreateCommand": "go version", From ead605e3877363cc3a5a61f2d4684735bb256a01 Mon Sep 17 00:00:00 2001 From: koudaiii Date: Sun, 24 Apr 2022 16:27:33 +0900 Subject: [PATCH 3/8] Remove redundant config. --- .devcontainer/devcontainer.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 440e5b8..636fc4e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,9 +8,7 @@ // Update the VARIANT arg to pick a version of Go: 1, 1.18, 1.17 // Append -bullseye or -buster to pin to an OS version. // Use -bullseye variants on local arm64/Apple Silicon. - "VARIANT": "1.17", - // Options - "NODE_VERSION": "none" + "VARIANT": "1.17" } }, "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], From 64009beed83fee584ed6bb6c35b6c2dbb57cb229 Mon Sep 17 00:00:00 2001 From: koudaiii Date: Sun, 24 Apr 2022 16:59:06 +0900 Subject: [PATCH 4/8] By deafult, we use the latest version of terrafrom in devcontainer. --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 636fc4e..98654d6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -34,7 +34,7 @@ // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", "features": { - "terraform": "0.15", + "terraform": "latest", "azure-cli": "latest" } } From f701589a8094c657fad1f1e926efb746fefdf980 Mon Sep 17 00:00:00 2001 From: koudaiii Date: Sun, 24 Apr 2022 17:21:09 +0900 Subject: [PATCH 5/8] Remove Nodejs in Dockerfile --- .devcontainer/Dockerfile | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 117984f..fcff860 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,18 +3,3 @@ # [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster ARG VARIANT="1.18-bullseye" FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} - -# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 -ARG NODE_VERSION="none" -RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /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 - -# [Optional] Uncomment the next lines to use go get to install anything else you need -# USER vscode -# 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 From dfe02b2bfa274fd8644ce81904c948c06f461539 Mon Sep 17 00:00:00 2001 From: koudaiii Date: Sun, 24 Apr 2022 17:41:10 +0900 Subject: [PATCH 6/8] 'make depscheck' command run commands after the container is created. --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 98654d6..0d40d21 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -29,7 +29,7 @@ "forwardPorts": [45883], // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "go version", + "postCreateCommand": "make depscheck", // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", From a23bb57973e953636c30093345e4756ebd5338b9 Mon Sep 17 00:00:00 2001 From: koudaiii Date: Sun, 24 Apr 2022 19:05:10 +0900 Subject: [PATCH 7/8] Revert "'make depscheck' command run commands after the container is created." This reverts commit dfe02b2bfa274fd8644ce81904c948c06f461539. --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0d40d21..98654d6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -29,7 +29,7 @@ "forwardPorts": [45883], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "make depscheck", + // "postCreateCommand": "go version", // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", From e497af93c7b5cca3e61caa80d84a953d668ff16e Mon Sep 17 00:00:00 2001 From: koudaiii Date: Sun, 24 Apr 2022 19:12:37 +0900 Subject: [PATCH 8/8] Removed 'postCreateCommand' comment generated by VS code. Because 'postCreateCommand' is not used. --- .devcontainer/devcontainer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 98654d6..a4c95ad 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -28,9 +28,6 @@ // Use 'forwardPorts' to make a list of ports inside the container available locally. "forwardPorts": [45883], - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "go version", - // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", "features": {