Skip to content

Commit 60d6c6b

Browse files
authored
[devcontainer] Version bump and enhanced UX. (#35403)
* Version bump, remove unnecessary libs * Allow environment location modification * Add apt installs to base image * Speed-up image building * Remove unneeded apt installs * Expose and document important env variable * Add all pigweed environments to .gitignore * Revert and reformat comment * Compatibility fix
1 parent ecf66e6 commit 60d6c6b

File tree

4 files changed

+31
-20
lines changed

4 files changed

+31
-20
lines changed

.devcontainer/Dockerfile

+22-16
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,19 @@ ARG USER_UID=1000
2424
ARG USER_GID=$USER_UID
2525
ENV LANG en_US.utf8
2626

27-
# these are installed for terminal/dev convenience. If more tooling for build is required, please
28-
# add them to chip-build (in integrations/docker/images/chip-build)
27+
28+
# These are installed for terminal/dev convenience. If more tooling for build is required, please
29+
# add them to chip-build (in integrations/docker/images/chip-build).
2930
RUN apt-get update \
3031
&& apt-get install -y locales \
3132
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
32-
&& apt-get -fy install git vim emacs sudo \
33+
&& apt-get -fy install vim emacs sudo \
3334
apt-utils dialog zsh \
34-
iproute2 procps lsb-release \
35+
lsb-release \
3536
bash-completion \
36-
build-essential cmake cppcheck valgrind \
37-
wget curl telnet \
37+
valgrind \
3838
docker.io \
39-
iputils-ping net-tools \
40-
libncurses5 \
41-
libncursesw5 \
42-
libpython2.7 \
39+
iputils-ping \
4340
&& :
4441

4542
RUN groupadd -g $USER_GID $USERNAME \
@@ -55,13 +52,22 @@ RUN curl https://raw.githubusercontent.com/restyled-io/restyler/master/bin/resty
5552
RUN mkdir -p /opt/sdk/sdks/ \
5653
&& chown -R $USERNAME:$USERNAME \
5754
/opt/sdk/sdks/ `# NXP uses a patch_sdk script to change SDK files` \
58-
/opt/NordicSemiconductor/nrfconnect/ `# $USERNAME needs to own west configuration to build nRF Connect examples` \
59-
$IDF_PATH `# $USERNAME needs to own the esp-idf and tools for the examples to build` \
55+
$ANDROID_HOME \
56+
$IDF_TOOLS_PATH \
57+
&& find $AMEBA_PATH -name "inc_lp" -print0 | xargs -0 chown -R $USERNAME:$USERNAME \
58+
&& find $AMEBA_PATH -name "inc_hp" -print0 | xargs -0 chown -R $USERNAME:$USERNAME \
59+
&& find $AMEBA_PATH -name "project_lp" -print0 | xargs -0 chown -R $USERNAME:$USERNAME \
60+
&& find $AMEBA_PATH -name "project_hp" -print0 | xargs -0 chown -R $USERNAME:$USERNAME \
61+
&& chmod -R +x \
62+
$ANDROID_HOME/tools/bin `# sdkmanager for accepting licenses`\
63+
&& chmod -R +w \
6064
$IDF_TOOLS_PATH \
61-
$SYSROOT_AARCH64 `# allow read/write access to header and libraries` \
62-
$ANDROID_HOME `# allow licenses to be accepted` \
63-
$AMEBA_PATH `# AmebaD requires access to change build_info.h` \
64-
$IMX_SDK_ROOT \
65+
&& find $AMEBA_PATH -name "inc_lp" -print0 | xargs -0 chmod -R +w \
66+
&& find $AMEBA_PATH -name "inc_hp" -print0 | xargs -0 chmod -R +w \
67+
&& find $AMEBA_PATH -name "project_lp" -print0 | xargs -0 chmod -R +w \
68+
&& find $AMEBA_PATH -name "project_hp" -print0 | xargs -0 chmod -R +w \
69+
# Safe directory is preffered over chown.
70+
&& git config --global --add safe.directory "*" \
6571
&& :
6672

6773
# Fix Tizen SDK paths for new user

.devcontainer/devcontainer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
"mounts": [
1515
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
1616
],
17-
"initializeCommand": "bash .devcontainer/build.sh --tag matter-dev-environment:local --version 22",
17+
"initializeCommand": "bash .devcontainer/build.sh --tag matter-dev-environment:local --version 74",
1818
"image": "matter-dev-environment:local",
1919
"remoteUser": "vscode",
20+
"containerEnv": {
21+
"PW_ENVIRONMENT_ROOT": "${containerWorkspaceFolder}/.environment-vscode"
22+
},
2023
"customizations": {
2124
"vscode": {
2225
// Add the IDs of extensions you want installed when the container is created in the array below.

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ out/
1515
/src/darwin/Framework/build/
1616

1717
# Pigweed Environment
18-
.environment/
18+
.environment*/
1919
build_overrides/pigweed_environment.gni
2020

2121
# Temporary Directories
@@ -84,4 +84,3 @@ examples/*/esp32/dependencies.lock
8484

8585
# jupyter temporary files
8686
.ipynb_checkpoints
87-

integrations/docker/images/vscode/chip-build-vscode/Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ ENV NXP_K32W0_SDK_ROOT=/opt/k32w/core
130130
ENV NXP_K32W1_SDK_ROOT=/opt/k32w/k32w1
131131
ENV NXP_SDK_ROOT=/opt/nxp-sdk/rw61x
132132
ENV OPENOCD_PATH=/opt/openocd/
133-
ENV PW_ENVIRONMENT_ROOT=/home/vscode/pigweed/env
134133
ENV QEMU_ESP32=/opt/espressif/qemu/qemu-system-xtensa
135134
ENV QEMU_ESP32_DIR=/opt/espressif/qemu
136135
ENV SYSROOT_AARCH64=/opt/ubuntu-22.04.1-aarch64-sysroot
@@ -144,6 +143,10 @@ ENV ZEPHYR_NXP_BASE=/opt/nxp-zephyr/zephyrproject/zephyr
144143
ENV ZEPHYR_NXP_SDK_INSTALL_DIR=/opt/nxp-zephyr/zephyr-sdk-0.16.5
145144
ENV NXP_UPDATE_SDK_SCRIPT_DOCKER=/opt/nxp/nxp_matter_support/scripts/update_nxp_sdk.py
146145

146+
# Places bootstrap files there instead of the default one which is `.environment`.
147+
# NOTE: This directory is NOT persistent.
148+
ENV PW_ENVIRONMENT_ROOT=/home/vscode/pigweed/env
149+
147150
ENV TIZEN_VERSION 7.0
148151
ENV TIZEN_SDK_ROOT /opt/tizen-sdk
149152
ENV TIZEN_SDK_TOOLCHAIN $TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2

0 commit comments

Comments
 (0)