diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..ae98ca288d --- /dev/null +++ b/.devcontainer/Dockerfile @@ -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"] \ No newline at end of file diff --git a/.devcontainer/bash_completion b/.devcontainer/bash_completion new file mode 100644 index 0000000000..0a96df4c8a --- /dev/null +++ b/.devcontainer/bash_completion @@ -0,0 +1,3 @@ +for bcfile in ~/.bash_completion.d/* ; do + . $bcfile +done diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..fa0d5c39f4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" + ] + } + } +} \ No newline at end of file diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 0000000000..038a2e5cdf --- /dev/null +++ b/.devcontainer/post-create.sh @@ -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 \ No newline at end of file diff --git a/.devcontainer/post-start.sh b/.devcontainer/post-start.sh new file mode 100644 index 0000000000..8435770977 --- /dev/null +++ b/.devcontainer/post-start.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +WORKSPACE_DIR=$1 + +cd $WORKSPACE_DIR + +west update \ No newline at end of file diff --git a/CODEOWNERS b/CODEOWNERS index a1329a5eb3..392f38b627 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -71,3 +71,6 @@ # Get all docs reviewed *.rst @rexut + +# Devcontainer setup for vscode +/.devcontainer/ @rexut