Skip to content

Commit

Permalink
feat(build-env): Add VS Code dev container for build environment, and…
Browse files Browse the repository at this point in the history
… add build instructions to the README. (solana-developers#78)
  • Loading branch information
j-h-a authored Dec 10, 2021
1 parent 49424d6 commit 782c7d7
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.209.3/containers/typescript-node/.devcontainer/base.Dockerfile

# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster
ARG VARIANT="16-buster"
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}

# [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 if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# [Optional] Uncomment if you want to install more global node packages
# RUN su node -c "npm install -g <your-package-list -here>"
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 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.209.3/containers/typescript-node
{
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"args": {
"VARIANT": "16-buster"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {},


// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint"
],

// 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": "yarn install",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ Deep Dive
Other Resources
```

### Building

We recommend building and running the documentation in a development container
(requires Docker to be installed).
A `Dockerfile` is included in the `.devcontainer` directory which can be built
and run manually using docker or automatically by VS Code
([Instructions here](https://code.visualstudio.com/docs/remote/containers)).

To build and run perform the following commands in the terminal
(within the container if using the dev container)

```
yarn install
yarn start
```

It will take some time to start, the documentation can then be viewed
at (http://localhost:8080/)

### Committing
We are using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
for this repository.
Expand Down

0 comments on commit 782c7d7

Please sign in to comment.