-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add devcontainer integration for vscode
This will auto setup the whole build environment based on zephyr's docker containers. Prerequisites are: - docker is accessable by the user without using sudo - vscode with remote container extension is installed Signed-off-by: Andreas Kurz <[email protected]> Signed-off-by: Stephan Linz <[email protected]>
- Loading branch information
1 parent
0cde462
commit 55e6f3d
Showing
6 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
ARG ZEPHYR_TAG=latest | ||
FROM zephyrprojectrtos/ci:${ZEPHYR_TAG} | ||
|
||
# Set default to bash instead sh | ||
ENV SHELL /bin/bash | ||
|
||
RUN add-apt-repository ppa:tiac-systems/doxygen | ||
|
||
# Install packages | ||
RUN apt-get -y update && \ | ||
apt-get -y upgrade && \ | ||
apt-get install --no-install-recommends -y \ | ||
doxygen \ | ||
graphviz \ | ||
mscgen \ | ||
latexmk \ | ||
librsvg2-bin \ | ||
texlive-latex-base \ | ||
texlive-latex-extra \ | ||
texlive-fonts-recommended \ | ||
usbutils \ | ||
vim | ||
|
||
# Clean up stale packages | ||
RUN apt-get clean -y && \ | ||
apt-get autoremove --purge -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Add bash completion script | ||
ADD ./bash_completion /home/user/.bash_completion | ||
RUN mkdir -p /home/user/.bash_completion.d | ||
|
||
# Switch to 'user' context | ||
USER user | ||
|
||
RUN mkdir -p /home/user/.vscode-server/extensions | ||
|
||
# Set working directory | ||
WORKDIR /workdir | ||
VOLUME ["/workdir"] | ||
|
||
# Adjust 'user' home directory permissions | ||
USER root | ||
RUN chown -R user:user /home/user | ||
|
||
# Make 'user' default on launch | ||
USER user | ||
|
||
# Launch bash shell by default | ||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
for bcfile in ~/.bash_completion.d/* ; do | ||
. $bcfile | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
{ | ||
"name": "Bridle", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
// Specify version for Zephyr Container | ||
// See https://github.com/zephyrproject-rtos/docker-image/releases | ||
"args": { "ZEPHYR_TAG": "v0.26.4" } | ||
}, | ||
// Needed for USB devices in container | ||
"privileged": true, | ||
"postCreateCommand": "bash .devcontainer/post-create.sh /workspace ${localWorkspaceFolderBasename}", | ||
"postStartCommand": "bash .devcontainer/post-start.sh /workspace", | ||
// Mount and set workspace folder | ||
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspace,type=bind", | ||
"workspaceFolder": "/workspace/${localWorkspaceFolderBasename}", | ||
// Username in container - align with Dockerfil | ||
"remoteUser": "user", | ||
"mounts": [ | ||
// Persist installed extensions in container | ||
"source=bridle-devcontainer-extensions,target=/home/user/.vscode-server/extensions,type=volume", | ||
// Allow attaching USB devices to running container | ||
"source=/dev/bus/usb,target=/dev/bus/usb,type=bind" | ||
],"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"editor.trimAutoWhitespace": true, | ||
"editor.insertFinalNewline": true | ||
}, | ||
"extensions": [ | ||
"marus25.cortex-debug" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
WORKSPACE_DIR=$1 | ||
REPO_NAME=$2 | ||
|
||
cd $WORKSPACE_DIR | ||
|
||
if [ ! -d ".west" ]; then | ||
west init -l $REPO_NAME | ||
fi | ||
|
||
west update | ||
west bridle-export | ||
|
||
|
||
pip3 install --upgrade --requirement zephyr/scripts/requirements.txt | ||
pip3 install --upgrade --requirement bridle/scripts/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
WORKSPACE_DIR=$1 | ||
|
||
cd $WORKSPACE_DIR | ||
|
||
west update |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,3 +71,6 @@ | |
|
||
# Get all docs reviewed | ||
*.rst @rexut | ||
|
||
# Devcontainer setup for vscode | ||
/.devcontainer/ @rexut |