Skip to content

Add Mise Runtime Version Manager Feature #1356

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/mise/NOTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Using Mise in your Dev Container

After installing Mise, you can manage language versions by adding a `.mise.toml` file to your project root:

```toml
[tools]
node = "20"
python = "3.11"
```

Or use the CLI to install tools:

```bash
mise install node@20
mise install [email protected]
```

For more information on using Mise, see the [official documentation](https://mise.jdx.dev/).

## OS Support

This Feature should work on recent versions of Debian/Ubuntu, RedHat Enterprise Linux, Fedora, and Alpine Linux distributions with the `apt`, `yum` or `dnf` package manager installed.

`bash` is required to execute the `install.sh` script.
41 changes: 41 additions & 0 deletions src/mise/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"id": "mise",
"version": "1.0.0",
"name": "Mise (formerly RTX)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/mise",
"description": "Installs Mise, the unified runtime version manager (formerly RTX). Mise works like asdf, rvm, nvm, pyenv, etc - but is a single unified tool for managing all your runtimes.",
"options": {
"version": {
"type": "string",
"proposals": [
"latest",
"none",
"v2025.5.0",
"v2025.4.12",
"v2025.4.11",
"v2025.4.10"
],
"default": "latest",
"description": "Select or enter a Mise version to install"
},
"installPlugins": {
"type": "string",
"default": "",
"description": "Comma separated list of Mise plugins to install (e.g., 'node,python,ruby')"
}
},
"customizations": {
"vscode": {
"settings": {
"github.copilot.chat.codeGeneration.instructions": [
{
"text": "This dev container includes Mise (formerly RTX), a unified runtime version manager pre-installed and available on the `PATH`. Mise allows you to manage multiple programming language versions (similar to asdf, nvm, pyenv, etc.) with a single tool."
}
]
}
}
},
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
]
}
66 changes: 66 additions & 0 deletions src/mise/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/devcontainers/features/tree/main/src/mise
# Maintainer: The Dev Container spec maintainers

set -eux

# Feature options
MISE_VERSION="${VERSION}"
INSTALL_PLUGINS="${INSTALLPLUGINS:-""}"

# Install dependencies based on OS
. /etc/os-release

echo "(*) Installing dependencies for ${ID}..."
if [ "${ID}" = "debian" ] || [ "${ID}" = "ubuntu" ]; then
apt-get update
apt-get install -y curl ca-certificates
elif [ "${ID}" = "fedora" ] || [ "${ID}" = "rhel" ] || [ "${ID}" = "centos" ] || [ "${ID}" = "rocky" ] || [ "${ID}" = "almalinux" ]; then
if command -v dnf >/dev/null; then
dnf install -y curl
else
yum install -y curl
fi
fi

# Install mise using the appropriate method for the OS
if [ "${MISE_VERSION}" != "none" ]; then
echo "(*) Installing mise version ${MISE_VERSION}..."

export MISE_INSTALL_PATH="/usr/local/bin/mise"
if [ "${MISE_VERSION:-latest}" = "latest" ]; then
# latest: installer’s default, so don’t set MISE_VERSION
curl -sSf https://mise.run | sh
else
# pinned: pass through MISE_VERSION
curl -sSf https://mise.run | MISE_VERSION="${MISE_VERSION}" sh
fi

# Verify mise is installed
if command -v mise >/dev/null 2>&1; then
echo "mise installed successfully: $(mise --version)"
else
echo "ERROR: mise installation failed. Could not find mise in PATH."
exit 1
fi

# Install plugins if specified
if [ -n "${INSTALL_PLUGINS}" ]; then
echo "Installing mise plugins: ${INSTALL_PLUGINS}"
IFS=","
read -ra plugins <<< "${INSTALL_PLUGINS}"
for plugin in "${plugins[@]}"; do
echo "Installing plugin: ${plugin}"
mise plugins install ${plugin}
done
fi
else
echo "Skipping mise installation as 'none' was specified."
fi

echo "Done!"
15 changes: 15 additions & 0 deletions test/mise/debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
check "mise version" mise --version

# Check for correct Debian paths
check "mise in PATH" bash -c "which mise | grep '/usr/local/bin/mise\\|/usr/bin/mise'"

# Report result
reportResults
18 changes: 18 additions & 0 deletions test/mise/fedora.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
check "mise version" mise --version

# Print out where mise actually lives
echo "DEBUG: mise resolved to: $(command -v mise)"

# Check for correct Fedora paths
check "mise in PATH" bash -c "command -v mise | grep '/usr/local/bin/mise'"

# Report result
reportResults
12 changes: 12 additions & 0 deletions test/mise/install_specific_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Check we have the expected version of mise
check "mise version v2024.5.17" bash -c "mise --version | grep '2024.5.17'"

# Report result
reportResults
16 changes: 16 additions & 0 deletions test/mise/install_with_plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Check for mise
check "mise version" mise --version

# Check for plugins
check "yarn plugin installed" bash -c "mise plugins list | grep yarn"
check "redis plugin installed" bash -c "mise plugins list | grep redis"

# Report result
reportResults
17 changes: 17 additions & 0 deletions test/mise/rhel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib
# Print out where mise actually lives
echo "DEBUG: mise resolved to: $(which mise)"

# Definition specific tests
check "mise version" mise --version

# Check for correct RHEL paths
check "mise in PATH" bash -c "command -v mise | grep '/usr/local/bin/mise'"

# Report result
reportResults
36 changes: 36 additions & 0 deletions test/mise/scenarios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"install_specific_version": {
"image": "ubuntu:focal",
"features": {
"mise": {
"version": "v2024.5.17"
}
}
},
"install_with_plugins": {
"image": "ubuntu:focal",
"features": {
"mise": {
"installPlugins": "yarn,redis"
}
}
},
"rhel": {
"image": "almalinux:8",
"features": {
"mise": {}
}
},
"debian": {
"image": "debian:bullseye",
"features": {
"mise": {}
}
},
"fedora": {
"image": "fedora:latest",
"features": {
"mise": {}
}
}
}
14 changes: 14 additions & 0 deletions test/mise/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
check "mise version" mise --version
check "mise activate command" mise activate bash
check "mise plugins command" mise plugins list

# Report result
reportResults