|
6 | 6 |
|
7 | 7 | | Metadata | Value | |
8 | 8 | |----------|-------| |
9 | | -| *Contributors* | The VS Code Team | |
10 | 9 | | *Categories* | Core, Languages | |
11 | | -| *Definition type* | Dockerfile | |
12 | | -| *Published image* | mcr.microsoft.com/vscode/devcontainers/typescript-node | |
13 | | -| *Available image variants* | 12 / 12-buster, 14 / 14-buster, 16 / 16-buster, 12-bullseye, 14-bullseye, 16-bullseye ([full list](https://mcr.microsoft.com/v2/vscode/devcontainers/javascript-node/tags/list)) | |
| 10 | +| *Image type* | Dockerfile | |
| 11 | +| *Published image* | mcr.microsoft.com/devcontainers/typescript-node | |
| 12 | +| *Available image variants* | 12 / 12-buster, 14 / 14-buster, 16 / 16-buster, 12-bullseye, 14-bullseye, 16-bullseye ([full list](https://mcr.microsoft.com/v2/devcontainers/javascript-node/tags/list)) | |
14 | 13 | | *Published image architecture(s)* | x86-64, arm64/aarch64 for `bullseye` variants | |
15 | | -| *Works in Codespaces* | Yes | |
16 | 14 | | *Container host OS support* | Linux, macOS, Windows | |
17 | 15 | | *Container OS* | Debian | |
18 | 16 | | *Languages, platforms* | Node.js, TypeScript | |
19 | 17 |
|
20 | | -See **[history](history)** for information on the contents of published images. |
| 18 | +## Using this image |
21 | 19 |
|
22 | | -## Using this definition |
| 20 | +You can directly reference pre-built versions of `Dockerfile` by using the `image` property in `.devcontainer/devcontainer.json` or updating the `FROM` statement in your own `Dockerfile` to one of the following. An example `Dockerfile` is included in this repository. |
23 | 21 |
|
24 | | -While the definition itself works unmodified, you can select the version of Node.js the container uses by updating the `VARIANT` arg in the included `devcontainer.json` (and rebuilding if you've already created the container). |
25 | | - |
26 | | -```jsonc |
27 | | -// Or you can use 14-bullseye or 14-buster if you want to pin to an OS version |
28 | | -"args": { "VARIANT": "14" } |
29 | | -``` |
30 | | - |
31 | | -You can also directly reference pre-built versions of `.devcontainer/base.Dockerfile` by using the `image` property in `.devcontainer/devcontainer.json` or updating the `FROM` statement in your own `Dockerfile` with one of the following: |
32 | | - |
33 | | -- `mcr.microsoft.com/vscode/devcontainers/typescript-node` (latest) |
34 | | -- `mcr.microsoft.com/vscode/devcontainers/typescript-node:16` (or `16-bullseye`, `16-buster` to pin to an OS version) |
35 | | -- `mcr.microsoft.com/vscode/devcontainers/typescript-node:14` (or `14-bullseye`, `14-buster` to pin to an OS version) |
36 | | -- `mcr.microsoft.com/vscode/devcontainers/typescript-node:12` (or `12-bullseye`, `12-buster` to pin to an OS version) |
| 22 | +- `mcr.microsoft.com/devcontainers/typescript-node` (latest) |
| 23 | +- `mcr.microsoft.com/devcontainers/typescript-node:16` (or `16-bullseye`, `16-buster` to pin to an OS version) |
| 24 | +- `mcr.microsoft.com/devcontainers/typescript-node:14` (or `14-bullseye`, `14-buster` to pin to an OS version) |
| 25 | +- `mcr.microsoft.com/devcontainers/typescript-node:12` (or `12-bullseye`, `12-buster` to pin to an OS version) |
37 | 26 |
|
38 | 27 | You can decide how often you want updates by referencing a [semantic version](https://semver.org/) of each image. For example: |
39 | 28 |
|
40 | | -- `mcr.microsoft.com/vscode/devcontainers/typescript-node:0-14` (or `0-14-bullseye`, `0-14-buster`) |
41 | | -- `mcr.microsoft.com/vscode/devcontainers/typescript-node:0.204-14` (or `0.203-14-bullseye`, `0.203-14-buster`) |
42 | | -- `mcr.microsoft.com/vscode/devcontainers/typescript-node:0.204.0-14` (or `0.203.0-14-bullseye`, `0.203.0-14-buster`) |
43 | | - |
44 | | -However, we only do security patching on the latest [non-breaking, in support](https://github.com/microsoft/vscode-dev-containers/issues/532) versions of images (e.g. `0-14`). You may want to run `apt-get update && apt-get upgrade` in your Dockerfile if you lock to a more specific version to at least pick up OS security updates. |
| 29 | +- `mcr.microsoft.com/devcontainers/typescript-node:0-14` (or `0-14-bullseye`, `0-14-buster`) |
| 30 | +- `mcr.microsoft.com/devcontainers/typescript-node:0.204-14` (or `0.203-14-bullseye`, `0.203-14-buster`) |
| 31 | +- `mcr.microsoft.com/devcontainers/typescript-node:0.204.0-14` (or `0.203.0-14-bullseye`, `0.203.0-14-buster`) |
45 | 32 |
|
46 | | -See [history](history) for information on the contents of each version and [here for a complete list of available tags](https://mcr.microsoft.com/v2/vscode/devcontainers/typescript-node/tags/list). |
47 | | - |
48 | | -Alternatively, you can use the contents of the `base.Dockerfile` or the [JavaScript and Node.js `base.Dockerfile`](../javascript-node/.devcontainer/base.Dockerfile) to fully customize your container's contents. |
| 33 | +However, we only do security patching on the latest [non-breaking, in support](https://github.com/microsoft/vscode-dev-containers/issues/532) versions of images (e.g. `0-1.16`). You may want to run `apt-get update && apt-get upgrade` in your Dockerfile if you lock to a more specific version to at least pick up OS security updates. |
49 | 34 |
|
50 | 35 | Beyond TypeScript, Node.js, and `git`, this image / `Dockerfile` includes `eslint`, `zsh`, [Oh My Zsh!](https://ohmyz.sh/), a non-root `node` user with `sudo` access, and a set of common dependencies for development. Since `tslint` is [now fully deprecated](https://github.com/palantir/tslint/issues/4534), the definition includes `tslint-to-eslint-config` globally to help you migrate. |
51 | 36 |
|
52 | 37 | Note that, while `eslint`and `typescript` are installed globally for convenance, [as of ESLint 6](https://eslint.org/docs/user-guide/migrating-to-6.0.0#-plugins-and-shareable-configs-are-no-longer-affected-by-eslints-location), you will need to install the following packages locally to lint TypeScript code: `@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser`, `eslint`, `typescript`. |
53 | 38 |
|
54 | | -### Adding the definition to a project or codespace |
55 | | - |
56 | | -1. If this is your first time using a development container, please see getting started information on [setting up](https://aka.ms/vscode-remote/containers/getting-started) Remote-Containers or [creating a codespace](https://aka.ms/ghcs-open-codespace) using GitHub Codespaces. |
57 | | - |
58 | | -2. To use the pre-built image: |
59 | | - 1. Start VS Code and open your project folder or connect to a codespace. |
60 | | - 2. Press <kbd>F1</kbd> select and **Add Development Container Configuration Files...** command for **Remote-Containers** or **Codespaces**. |
61 | | - 3. Select this definition. You may also need to select **Show All Definitions...** for it to appear. |
62 | | - |
63 | | -3. To build a custom version of the image instead: |
64 | | - 1. Clone this repository locally. |
65 | | - 2. Start VS Code and open your project folder or connect to a codespace. |
66 | | - 3. Use your local operating system's file explorer to drag-and-drop the locally cloned copy of the `.devcontainer` folder for this definition into the VS Code file explorer for your opened project or codespace. |
67 | | - 4. Update `.devcontainer/devcontainer.json` to reference `"dockerfile": "base.Dockerfile"`. |
68 | | - |
69 | | -4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs. |
70 | | - |
71 | | -5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** or **Codespaces: Rebuild Container** to start using the definition. |
72 | | - |
73 | | -## Testing the definition |
74 | | - |
75 | | -This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps: |
76 | | - |
77 | | -1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. |
78 | | -2. Clone this repository. |
79 | | -3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...** |
80 | | -4. Select the `containers/typescript-node` folder. |
81 | | -5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project. This will automatically run `npm install` and compile the source before starting it. |
82 | | -6. Once the project is running, press <kbd>F1</kbd> and select **Remote-Containers: Forward Port from Container...** |
83 | | -7. Select port 3000 and click the "Open Browser" button in the notification that appears. |
84 | | -8. You should see "Hello remote world!" after the page loads. |
85 | | -9. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing. |
86 | | - |
87 | 39 | ## License |
88 | 40 |
|
89 | 41 | Copyright (c) Microsoft Corporation. All rights reserved. |
90 | 42 |
|
91 | | -Licensed under the MIT License. See [LICENSE](https://github.com/microsoft/vscode-dev-containers/blob/main/LICENSE). |
| 43 | +Licensed under the MIT License. See [LICENSE](https://github.com/devcontainers/images/blob/main/LICENSE) |
0 commit comments