Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: creates a devcontainer configuration for contributors #10937

Merged
merged 8 commits into from
Mar 12, 2025
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "Node.js",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-20-bookworm",
Copy link
Contributor Author

@artis3n artis3n Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set Node 20 b/c when I try to use the node 22 image (or locally), I can get following error:

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason for picking this image? I suppose it doesn't make much difference for an application like this one with basically zero "system" dependencies beyond node, but my instinct would be to base this off be node:20-alpine since that is what we use in https://github.com/badges/shields/blob/master/Dockerfile

In any case, yes. We definitely want node 20

Copy link
Contributor Author

@artis3n artis3n Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vscode can generate a devcontainer which then uses Microsoft's set of "officially maintained" ones. That's where this image comes from. I can use a basic node:20-alpine as well, the devcontainer config will just need to also prep git and some other things. Given it's "the node image designed for devcontainers" managed by Microsoft, would you be fine leaving it in? Happy to change it to node:20-alpine and the subsequent other changes to the devcontainer if you'd prefer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that makes sense


// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-extra/features/prettier: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": "yarn install",
"postCreateCommand": "npm ci",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"christian-kohler.npm-intellisense",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ If you intend on reporting or contributing a fix related to security vulnerabili

## Development

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/badges/shields?quickstart=1)

1. Install Node 20 or later. You can use the [package manager][] of your choice.
Tests need to pass in Node 20 and 22.
2. Clone this repository.
Expand Down
Loading