-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
devcontainer
configuration (#468)
* Add `devcontainer` configuration Signed-off-by: Randall <[email protected]> * Add Changeset for devcontainer update * Add `devcontainer` instructions to README.md Signed-off-by: Randall <[email protected]> * Configure automatically Volta in Docker image Signed-off-by: Randall <[email protected]> * Modify `node-volta-debian.sh` for Volta and implement Signed-off-by: Randall <[email protected]> * Update devcontainer instructions in `README.md` Signed-off-by: Randall <[email protected]> * Correct spelling mistakes on `README.md` Signed-off-by: Randall <[email protected]> Signed-off-by: Randall <[email protected]>
- Loading branch information
Showing
10 changed files
with
968 additions
and
9 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,5 @@ | ||
--- | ||
|
||
--- | ||
|
||
Add `devcontainer` configuration |
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,39 @@ | ||
# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.19, 1.18, 1-bullseye, 1.19-bullseye, 1.18-bullseye, 1-buster, 1.19-buster, 1.18-buster | ||
ARG VARIANT=1-bullseye | ||
FROM golang:${VARIANT} | ||
|
||
# Copy library scripts to execute | ||
COPY library-scripts/*.sh library-scripts/*.env /tmp/library-scripts/ | ||
|
||
# [Option] Install zsh | ||
ARG INSTALL_ZSH="true" | ||
# [Option] Upgrade OS packages to their latest versions | ||
ARG UPGRADE_PACKAGES="true" | ||
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
RUN bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \ | ||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Go tools | ||
ENV GO111MODULE=auto | ||
RUN bash /tmp/library-scripts/go-debian.sh "none" "/usr/local/go" "${GOPATH}" "${USERNAME}" "false" \ | ||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* | ||
|
||
# [Choice] Node.js version: none, lts, 18, 16, 14 | ||
ARG NODE_VERSION="none" | ||
ENV VOLTA_DIR=/usr/local/share/volta | ||
ENV VOLTA_HOME=${VOLTA_DIR} | ||
RUN bash /tmp/library-scripts/node-volta-debian.sh "${VOLTA_DIR}" "${NODE_VERSION}" "${USERNAME}" \ | ||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* | ||
|
||
# Remove library scripts for final image | ||
RUN rm -rf /tmp/library-scripts | ||
|
||
# [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 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> |
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,48 @@ | ||
// 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.241.1/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" | ||
} | ||
}, | ||
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], | ||
|
||
"remoteEnv": { "NODE_ENV": "${containerEnv:NODE_ENV}development" }, | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
// 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", | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
"astro-build.astro-vscode" | ||
] | ||
} | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [ 3000 ], | ||
"portsAttributes": {"3000": {"label": "Vite devServer port"}}, | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "volta install node && volta install [email protected]", | ||
|
||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Warning: Folder contents may be replaced | ||
|
||
The contents of this folder will be automatically replaced with a file of the same name in the [vscode-dev-containers](https://github.com/microsoft/vscode-dev-containers) repository's [script-library folder](https://github.com/microsoft/vscode-dev-containers/tree/main/script-library) whenever the repository is packaged. | ||
|
||
To retain your edits, move the file to a different location. You may also delete the files if they are not needed. |
Oops, something went wrong.