Skip to content

Commit 2727637

Browse files
misha98857thePunderWoman
authored andcommitted
build: update dev container configuration
build: update dev container configuration build: update dev container configuration Update dev container configuration files to support latest environment. - Use customizations.vscode structure instead of deprecated extensions property. - Update bazel extension to BazelBuild.vscode-bazel. - Ignore .pnpm-store directory. - Update ports list - Use forwardPorts instead appPort Document the usage of Dev Containers in building-and-testing-angular.md.
1 parent f53f878 commit 2727637

4 files changed

Lines changed: 30 additions & 17 deletions

File tree

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
# Image metadata and config.
22
# Ideally, the Node.js version should match what we use on CI.
3-
FROM cimg/node:18.13.0@sha256:45d0ee279f522c4562a464df71108104cc9b2187205333ffd0707d4f05589731
4-
3+
FROM cimg/node:22.21.1-browsers@sha256:eee8ed828d5a54196456a86ac6872c43325acad54e59632261e23b486c458992
54

65
LABEL name="Angular dev environment" \
7-
description="This image can be used to create a dev environment for building Angular." \
8-
vendor="angular" \
9-
version="1.0"
10-
11-
EXPOSE 4000 4200 4433 5000 8080 9876
6+
description="This image can be used to create a dev environment for building Angular." \
7+
vendor="angular" \
8+
version="1.0"
129

10+
EXPOSE 4200 4201 4205 4206 9876
1311

1412
# Switch to `root`.
1513
USER root
1614

17-
18-
# Configure `Node.js`/`npm`.
19-
RUN npm config --global set user root
20-
21-
2215
# Go! (And keep going.)
2316
CMD ["tail", "--follow", "/dev/null"]

.devcontainer/recommended-devcontainer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
{
33
"name": "Angular dev container",
44
"dockerFile": "Dockerfile",
5-
"appPort": [4000, 4200, 4433, 5000, 8080, 9876],
5+
"forwardPorts": [4200, 4201, 4205, 4206, 9876],
66
"postCreateCommand": "pnpm install",
7-
"extensions": [
8-
"devondcarew.bazel-code",
9-
"ms-vscode.vscode-typescript-tslint-plugin"
10-
],
7+
"customizations": {
8+
"vscode": {
9+
"extensions": ["BazelBuild.vscode-bazel", "ms-vscode.vscode-typescript-tslint-plugin"]
10+
}
11+
}
1112
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ baseline.json
5454

5555
# Ignore cache created with the Angular CLI.
5656
.angular/
57+
58+
# pnpm store
59+
.pnpm-store

contributing-docs/building-and-testing-angular.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ It also explains the basic mechanics of using `git`, `node`, and `pnpm`.
55

66
- [Building and Testing Angular](#building-and-testing-angular)
77
- [Prerequisite Software](#prerequisite-software)
8+
- [Development in a Container](#development-in-a-container)
89
- [Getting the Sources](#getting-the-sources)
910
- [Installing NPM Modules](#installing-npm-modules)
1011
- [Building](#building)
@@ -52,6 +53,21 @@ following on your development machine:
5253
- On Windows: [MSYS2](https://www.msys2.org/) which is used by Bazel. Follow
5354
the [instructions](https://bazel.build/install/windows#installing-compilers-and-language-runtimes)
5455

56+
## Development in a Container
57+
58+
You can also use the provided [Dev Container](https://containers.dev/) configuration to set up a development environment. This approach uses Docker to create a container with all the necessary tools (Node.js, pnpm, etc.) pre-installed.
59+
60+
**Prerequisites:**
61+
62+
- [Docker Desktop](https://www.docker.com/products/docker-desktop)
63+
- [VS Code](https://code.visualstudio.com/)
64+
- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
65+
66+
**Usage:**
67+
68+
1. Open the Angular repository in VS Code.
69+
2. Run the **Dev Containers: Reopen in Container** command from the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`).
70+
5571
## Getting the Sources
5672

5773
Fork and clone the Angular repository:

0 commit comments

Comments
 (0)