Project toolchains
Install each project’s tools, such as Go, Node.js or Python, when its container is created, from the project’s mise configuration. Different worktrees can use different versions without affecting each other.
Every guide’s image already has mise for its global tools; this guide adds a hook that installs the project’s own tools too.
Set up
Use the files in examples/guides/mise:
# yaml-language-server: $schema=https://isodev.dyszkiewicz.me/config.schema.json
# Each project's toolchain, installed with mise when its container is created.
image: isodev-mise:latest
build:
context: image
lifecycle:
on_create:
scripts:
- file: hooks/mise.shFROM ubuntu:24.04
ARG DEBIAN_FRONTEND=noninteractive
# mise installs tools to ~/.local/share/mise and puts them on PATH through its
# shims. /usr/local/bin comes first, so files mounted there win.
ENV PATH=/root/.local/bin:/usr/local/sbin:/usr/local/bin:/root/.local/share/mise/shims:/usr/sbin:/usr/bin:/sbin:/bin
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl git \
&& rm -rf /var/lib/apt/lists/*
# mise, which installs the tools.
RUN curl -fsSL https://mise.run | MISE_INSTALL_PATH=/usr/local/bin/mise sh#!/bin/sh
# Runs once in each new container, in the workspace.
set -eu
# Install the project's tools when it has a mise or asdf configuration.
for config in mise.toml .mise.toml .tool-versions .config/mise/config.toml; do
if [ -f "$config" ]; then
mise trust
mise install
break
fi
doneThe hook installs the tools from a mise.toml, .mise.toml, .tool-versions or .config/mise/config.toml in the workspace. Workspaces without one get no tools. mise trust marks the project’s configuration as trusted, which mise requires before it runs it.
Use it
isodev up --recreate
isodev exec mise lsThe tools are on PATH through mise’s shims, in isodev exec, isodev enter and agents. After changing the project’s mise configuration, run isodev exec mise install. To avoid downloading the same tools in every container, add shared caches.
Trade-offs
- Project configuration runs in the container.
mise trustaccepts whatever the project’s configuration does, including environment variables and tasks. Only use it with projects you trust.