-
Notifications
You must be signed in to change notification settings - Fork 9
Added devcontainer based on up-rust devcontainer #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,48 @@ | ||
| ################################################################################ | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| ################################################################################ | ||
|
|
||
| FROM mcr.microsoft.com/devcontainers/rust:latest | ||
| ARG USERNAME=vscode | ||
| ARG TARGETARCH | ||
|
|
||
| RUN apt-get update && \ | ||
| export DEBIAN_FRONTEND=noninteractive && \ | ||
| apt-get -y install \ | ||
| curl \ | ||
| gcc \ | ||
| git \ | ||
| openjdk-17-jre \ | ||
| zip \ | ||
| libclang-dev \ | ||
| && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Download openfasttrace JARs and create shortcut oft executable | ||
| ARG OFT_CORE_VERSION=4.1.0 | ||
| ARG OFT_ASCIIDOC_PLUGIN_VERSION=0.3.0 | ||
| ENV LIB_DIR=/opt/oft/lib | ||
| RUN mkdir -p $LIB_DIR \ | ||
| && base_url=https://github.com/itsallcode \ | ||
| && wget -P $LIB_DIR ${base_url}/openfasttrace/releases/download/$OFT_CORE_VERSION/openfasttrace-$OFT_CORE_VERSION.jar \ | ||
| && wget -P $LIB_DIR ${base_url}/openfasttrace-asciidoc-plugin/releases/download/$OFT_ASCIIDOC_PLUGIN_VERSION/openfasttrace-asciidoc-plugin-$OFT_ASCIIDOC_PLUGIN_VERSION-with-dependencies.jar \ | ||
| && echo '#!/bin/bash\n\njava -cp "${LIB_DIR}/*" org.itsallcode.openfasttrace.core.cli.CliStarter "$@"' > /usr/local/bin/oft \ | ||
| && chmod +x /usr/local/bin/oft | ||
|
|
||
| # Before installing cargo tools, change to the user that will be used in the container later. | ||
| # The reason is that cargo creates some cache, etc. folders with the correct group rustlang, but | ||
| # without making them group writable. Easiest fix is to change to the correct user before the install, | ||
| # so that the owner is correct from the start. | ||
| USER ${USERNAME} | ||
|
|
||
| # Install cargo cli tools | ||
| RUN cargo install cargo-nextest cargo-deny cargo-tarpaulin --locked |
This file contains hidden or 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,86 @@ | ||
| // ################################################################################ | ||
| // Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| // | ||
| // See the NOTICE file(s) distributed with this work for additional | ||
| // information regarding copyright ownership. | ||
| // | ||
| // This program and the accompanying materials are made available under the | ||
| // terms of the Apache License Version 2.0 which is available at | ||
| // https: //www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // ################################################################################ | ||
| // | ||
| // For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
| // README at: https://github.com/devcontainers/templates/tree/main/src/rust | ||
| { | ||
| "name": "up-transport-iceoryx2-rust", | ||
| "build": { | ||
| "dockerfile": "Dockerfile" | ||
| }, | ||
| "runArgs": [ | ||
| "--privileged" | ||
| ], | ||
| "containerEnv": { | ||
| "WORKSPACE_FOLDER": "${containerWorkspaceFolder}" | ||
| }, | ||
| "mounts": [ | ||
| { | ||
| // This is a workaround which is again necessary on MacOS 14.0, it looks like this bug is back: | ||
| // https://github.com/microsoft/vscode-dev-containers/issues/1487#issuecomment-1143907307 | ||
| "type": "volume", | ||
| "source": "rust-volume", | ||
| "target": "/rust-volume" | ||
| }, | ||
| { | ||
| "type": "bind", | ||
| "source": "${localWorkspaceFolder}/.devcontainer/scripts", | ||
| "target": "/home/vscode/scripts" | ||
| }, | ||
| { | ||
| "type": "bind", | ||
| "source": "${localEnv:HOME}${localEnv:USERPROFILE}/.ssh", | ||
| "target": "/home/vscode/.ssh" | ||
| } | ||
| ], | ||
| "postCreateCommand": ".devcontainer/scripts/post-create.sh --workspace-folder='${containerWorkspaceFolder}'", | ||
| "workspaceMount": "source=${localWorkspaceFolder},target=/workspace/${localWorkspaceFolderBasename}/,type=bind", | ||
| "workspaceFolder": "/workspace/${localWorkspaceFolderBasename}/", | ||
| "remoteUser": "vscode", | ||
| "customizations": { | ||
| "vscode": { | ||
| // Set *default* container specific settings.json values on container create. | ||
| "settings": { | ||
| "lldb.executable": "/usr/bin/lldb", | ||
| // VS Code don't watch files under ./target | ||
| "files.watcherExclude": { | ||
| "**/target/**": true | ||
| }, | ||
| "rust-analyzer.check.command": "clippy", | ||
| "rust-analyzer.checkOnSave": true, | ||
| "coverage-gutters.coverageBaseDir": "**", | ||
| "coverage-gutters.coverageFileNames": [ | ||
| "target/tarpaulin/lcov.info" | ||
| ] | ||
| }, | ||
| // Add the IDs of extensions you want installed when the container is created. | ||
| "extensions": [ | ||
| "asciidoctor.asciidoctor-vscode", | ||
| "bianxianyang.htmlplay", | ||
| "bierner.markdown-mermaid", | ||
| "bierner.markdown-preview-github-styles", | ||
| "davidanson.vscode-markdownlint", | ||
| "gxl.git-graph-3", | ||
| "hediet.vscode-drawio", | ||
| "linusu.auto-dark-mode", | ||
| "ms-azuretools.vscode-containers", | ||
| "rust-lang.rust-analyzer", | ||
| "streetsidesoftware.code-spell-checker", | ||
| "tamasfe.even-better-toml", | ||
| "timonwong.shellcheck", | ||
| "vadimcn.vscode-lldb", | ||
| "yzhang.markdown-all-in-one" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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,47 @@ | ||
| #!/bin/bash | ||
|
PLeVasseur marked this conversation as resolved.
|
||
| ################################################################################ | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https: //www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| ################################################################################ | ||
|
|
||
| if [ -d "$HOME/.ssh" ]; then | ||
| source ${WORKSPACE_FOLDER}/.devcontainer/scripts/ensure-ssh-permissions.sh | ||
| fi | ||
| source ${WORKSPACE_FOLDER}/.devcontainer/scripts/colors.sh | ||
|
|
||
| PRIMARY_COLOR=$COLOR_GRAY | ||
| SECONDARY_COLOR=$COLOR_NC | ||
| INFO_COLOR=$COLOR_CYAN | ||
|
|
||
| WELCOME_INFO="${SECONDARY_COLOR} | ||
| ██ ██ ███████ ██ ██████ ██████ ███ ███ ███████ | ||
| ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ | ||
| ██ █ ██ █████ ██ ██ ██ ██ ██ ████ ██ █████ | ||
| ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ | ||
| ███ ███ ███████ ███████ ██████ ██████ ██ ██ ███████ | ||
| ${PRIMARY_COLOR} | ||
| to the Eclipse Foundation ${INFO_COLOR}$(basename "$WORKSPACE_FOLDER")${PRIMARY_COLOR} code repository | ||
|
|
||
| Workspace Folder ${SECONDARY_COLOR}$WORKSPACE_FOLDER | ||
|
|
||
| ${INFO_COLOR}Library Version(s)${PRIMARY_COLOR} | ||
| Rust Version ${SECONDARY_COLOR}$(rustc --version)${PRIMARY_COLOR} | ||
| Cargo Version ${SECONDARY_COLOR}$(cargo --version)${PRIMARY_COLOR} | ||
|
|
||
| ${INFO_COLOR}Git${PRIMARY_COLOR} | ||
| Username ${SECONDARY_COLOR}$(git config user.name)${PRIMARY_COLOR} | ||
| Email ${SECONDARY_COLOR}$(git config user.email)${PRIMARY_COLOR} | ||
|
|
||
| to see this info again, use the ${INFO_COLOR}welcome${PRIMARY_COLOR} command${COLOR_NC} | ||
| " | ||
|
|
||
| alias welcome='printf "$WELCOME_INFO"' | ||
| welcome | ||
This file contains hidden or 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,31 @@ | ||
| #!/bin/bash | ||
| ################################################################################ | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https: //www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| ################################################################################ | ||
|
|
||
| export COLOR_NC='\e[0m' # No Color | ||
| export COLOR_BLACK='\e[0;30m' | ||
| export COLOR_GRAY='\e[1;30m' | ||
| export COLOR_RED='\e[0;31m' | ||
| export COLOR_LIGHT_RED='\e[1;31m' | ||
| export COLOR_GREEN='\e[0;32m' | ||
| export COLOR_LIGHT_GREEN='\e[1;32m' | ||
| export COLOR_BROWN='\e[0;33m' | ||
| export COLOR_YELLOW='\e[1;33m' | ||
| export COLOR_BLUE='\e[0;34m' | ||
| export COLOR_LIGHT_BLUE='\e[1;34m' | ||
| export COLOR_PURPLE='\e[0;35m' | ||
| export COLOR_LIGHT_PURPLE='\e[1;35m' | ||
| export COLOR_CYAN='\e[0;36m' | ||
| export COLOR_LIGHT_CYAN='\e[1;36m' | ||
| export COLOR_LIGHT_GRAY='\e[0;37m' | ||
| export COLOR_WHITE='\e[1;37m' |
This file contains hidden or 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,23 @@ | ||
| #!/bin/bash | ||
| ################################################################################ | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https: //www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| ################################################################################ | ||
|
|
||
| # Sometimes when mounting volumes, the files unexpectedly change their read-write-execute status. | ||
| # This is dependent on the OS the Docker container is mounting from, and how it exposes its | ||
| # files permissions, ownership, and "executability" to the container and the containers user. | ||
| # | ||
| # More about specific permissions inside the .ssh folder | ||
| # https://serverfault.com/a/253314 | ||
| sudo find ~/.ssh -maxdepth 1 -type f -exec chmod 600 {} \; | ||
| chmod u+r ~/.ssh/config | ||
| chmod u+r ~/.ssh/known_hosts |
This file contains hidden or 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,42 @@ | ||
| #!/bin/bash | ||
| ################################################################################ | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https: //www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| ################################################################################ | ||
|
|
||
| get_arch_and_os() { | ||
| ARCH=$(uname -m) | ||
| OS=$(uname -s | tr "[:upper:]" "[:lower:]") | ||
|
|
||
| case "$ARCH" in | ||
| x86_64) | ||
| TARGET_ARCH="x86_64" | ||
| ;; | ||
| aarch64 | arm64) | ||
| TARGET_ARCH="aarch64" | ||
| ;; | ||
| *) | ||
| echo "Unsupported architecture: $ARCH" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| case "$OS" in | ||
| linux) | ||
| TARGET_OS="unknown-linux-gnu" | ||
| ;; | ||
| *) | ||
| echo "OS is unsupported or not implemented in this script: $OS" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| echo "$TARGET_ARCH $TARGET_OS" | ||
| } |
This file contains hidden or 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,29 @@ | ||
| #!/bin/bash | ||
| ################################################################################ | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https: //www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| ################################################################################ | ||
|
|
||
| install_rust_toolchain() { | ||
| source ${WORKSPACE_FOLDER}/.devcontainer/scripts/functions/get-arch-and-os.sh | ||
| read -r TARGET_ARCH TARGET_OS <<< "$(get_arch_and_os)" | ||
| ARCH_AND_OS="${TARGET_ARCH}-${TARGET_OS}" | ||
| echo "Detected architecture and OS: $ARCH_AND_OS" | ||
| RUST_TOOLCHAIN="stable-$ARCH_AND_OS" | ||
| if rustup toolchain list | grep -q $RUST_TOOLCHAIN; then | ||
| echo "Rust toolchain '$RUST_TOOLCHAIN' is already installed." | ||
| return 0 | ||
| fi | ||
| echo "Adding rustup target '$ARCH_AND_OS'" | ||
| rustup target add "$ARCH_AND_OS" | ||
| echo "Installing Rust toolchain for '$ARCH_AND_OS'" | ||
| rustup toolchain install "$RUST_TOOLCHAIN" | ||
| } |
This file contains hidden or 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,54 @@ | ||
| #!/bin/bash | ||
| ################################################################################ | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https: //www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| ################################################################################ | ||
|
|
||
| #region sudo stuff | ||
|
|
||
| HOST_OS="" | ||
| ARCH_AND_OS_FUNC="${WORKSPACE_FOLDER}/.devcontainer/scripts/functions/get-arch-and-os.sh" | ||
| if [[ -f "$ARCH_AND_OS_FUNC" ]]; then | ||
| source $ARCH_AND_OS_FUNC | ||
| read -r _ HOST_OS <<< "$(get_arch_and_os)" | ||
| fi | ||
| if [[ "$HOST_OS" == "darwin" ]]; then # darwin == Mac OS | ||
| # This is a workaround which is againt necessary on MacOS 14.0, it looks like this bug is back: | ||
| # https://github.com/microsoft/vscode-dev-containers/issues/1487#issuecomment-1143907307 | ||
| # grant permissions to mounted rust volume | ||
| echo "(Mac OS only) Granting permissions to mounted rust volume" | ||
| sudo chown vscode:vscode /rust-volume | ||
|
|
||
| # create /.cargo/config.toml in root folder | ||
| sudo mkdir /.cargo/ | ||
| sudo touch /.cargo/config.toml | ||
| sudo bash -c "cat << EOF > /.cargo/config.toml | ||
| [build] | ||
| target-dir = \"/rust-volume/target\" | ||
| EOF" | ||
| fi | ||
|
|
||
| if ! grep -q "bashrc_addition" ~/.bashrc && [[ -f "${WORKSPACE_FOLDER}/.devcontainer/scripts/bashrc_addition.sh" ]]; then | ||
| echo "source ${WORKSPACE_FOLDER}/.devcontainer/scripts/bashrc_addition.sh" >> ~/.bashrc | ||
| fi | ||
|
|
||
| #endregion | ||
|
|
||
| for arg in "$@"; do | ||
| if [[ "$arg" == --workspace-folder=* ]]; then | ||
| WORKSPACE_FOLDER="${arg#--workspace-folder=}" | ||
| fi | ||
| done | ||
| INSTALL_RUST_TOOLCHAIN_FUNC="${WORKSPACE_FOLDER}/.devcontainer/scripts/functions/install-rust-toolchain.sh" | ||
| if [[ -f "$INSTALL_RUST_TOOLCHAIN_FUNC" ]]; then | ||
| source $INSTALL_RUST_TOOLCHAIN_FUNC | ||
| install_rust_toolchain "$@" | ||
| fi |
This file contains hidden or 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 |
|---|---|---|
| @@ -1 +1,14 @@ | ||
| # ################################################################################ | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https: //www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ################################################################################ | ||
|
|
||
| * text=auto eol=lf |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.