From addf2c2782bd34b6e297eae0af30ab197fcf4b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20G=2E=20Atkinson=20A=2E?= <20444345+johnnv1@users.noreply.github.com> Date: Tue, 31 Dec 2024 14:23:40 -0300 Subject: [PATCH] feat (devcontainer): setup devcontainer for vscode (#206) - add devcontainer.json - add postCreateCommand.sh - update README.md --- .devcontainer/devcontainer.json | 21 +++++++++++++++++++++ .devcontainer/postCreateCommand.sh | 8 ++++++++ README.md | 15 +++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/postCreateCommand.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..eaef93f0 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "Rust", + "image": "mcr.microsoft.com/devcontainers/rust:1-1", + + // Set customizations for the container. + "customizations": { + "vscode": { + "extensions": [ + "rust-lang.rust-analyzer", + "streetsidesoftware.code-spell-checker", + "charliermarsh.ruff", + "Gruntfuggly.todo-tree", + "nefrob.vscode-just-syntax" + ] + } + }, + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh", + // Define the user to use. + "remoteUser": "root" +} diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100644 index 00000000..46cc9b1a --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -ex + +apt-get update && apt-get install -y cmake nasm libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev # Install NASM and GStreamer +curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin # Install Just for command runner +curl -LsSf https://astral.sh/uv/install.sh | sh # Install UV for manage python virtual environments +rustc --version diff --git a/README.md b/README.md index 5a16f907..8fdb0628 100644 --- a/README.md +++ b/README.md @@ -261,6 +261,21 @@ Available recipes: py-test # Test the kornia-py code with pytest test name='' # Test the code or a specific test ``` +### 🐳 Devcontainer + +This project includes a development container to provide a consistent development environment. + +The devcontainer is configured to include all necessary dependencies and tools required for building and testing the `kornia-rs` project. It ensures that the development environment is consistent across different machines and setups. + +**How to use** + +1. **Install Remote - Containers extension**: In Visual Studio Code, install the `Remote - Containers` extension from the Extensions view (`Ctrl+Shift+X`). + +2. **Open the project in the container**: + - Open the `kornia-rs` project folder in Visual Studio Code. + - Press `F1` and select `Remote-Containers: Reopen in Container`. + +Visual Studio Code will build the container and open the project inside it. You can now develop, build, and test the project within the containerized environment. ### 🦀 Rust