Skip to content

Commit

Permalink
feat (devcontainer): setup devcontainer for vscode (#206)
Browse files Browse the repository at this point in the history
- add devcontainer.json
- add postCreateCommand.sh
- update README.md
  • Loading branch information
johnnv1 authored Dec 31, 2024
1 parent 43ca2b6 commit addf2c2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
8 changes: 8 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit addf2c2

Please sign in to comment.