Running deno without installing it ... using podman

Sometimes you have good reason not to install development tools on your system (e.g. supply chain security concerns, no access, etc.).

If however you can run podman (in rootless mode), this simple function can be added to your shell's configuration file and it works most of the time as a replacement.

# place in $HOME/.bash_profile or $HOME/.zshrc config file
# may require tweaks for non-bash/zsh
# don't forget to logout/relogin to test

deno () {
  podman run \
    --interactive \
    --tty \
    --rm \
    --volume $PWD:/app \
    --volume $HOME/.deno:/deno-dir \
    --workdir /app \
    --publish 8000:8000 \
    denoland/deno:1.38.0 \
    "$@"
}	

When you do this, all the detritus/file debris and data will be located in a directory hiearchy within your home directory, specfically $HOME/.deno

Another benefit is that you can specify which version of deno to run and also modify any ports you wish to publish etc. The above is just an example.

Back to macktronics.com