jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
8.03k stars 210 forks source link

Unable to use mise inside ubuntu Dockerfile #2301

Closed ryan-dyer-sp closed 2 weeks ago

ryan-dyer-sp commented 2 weeks ago

Describe the bug I am trying to use mise to install a number of tools into an ubuntu:latest image. Installation and invocation of mise doctor show it is okay, but all attempts to mise use X end up with an error saying the tool is not installed.

To Reproduce Steps to reproduce the behavior.

Expected behavior Dockerfile

FROM ubuntu:latest
RUN mkdir -p /home/appuser /app
RUN useradd \
    --home "/home/appuser" \
    --shell "/usr/bin/bash" \
    --uid "${UID}" \
    appuser
RUN chown -R appuser:appuser /home/appuser
RUN apt-get update && apt upgrade -y
RUN apt install -y git jq curl yq unzip
COPY ./installer.sh app/installer.sh
RUN chmod +x app/installer.sh
USER appuser

RUN bash -c "app/installer.sh"

installer.sh

#!/usr/bin/env bash

set -x

curl -sL https://mise.run | bash
export PATH="$HOME/.local/share/mise/shims:$HOME/.local/bin/:$PATH"
mise version
eval "$(mise activate bash)"

mise doctor

export MISE_VERBOSE=1

RUST_BACKTRACE=full mise --verbose use -g yq@latest

mise doctor output

#15 2.324 + command mise doctor
#15 2.421 version: 2024.6.4 linux-x64 (e0e4107 2024-06-15)
#15 2.421 activated: no
#15 2.423 shims_on_path: yes
#15 2.424
#15 2.424 build_info:
#15 2.424   Target: x86_64-unknown-linux-gnu
#15 2.424   Features: DEFAULT, NATIVE_TLS, OPENSSL
#15 2.424   Built: Sat, 15 Jun 2024 12:35:48 +0000
#15 2.424   Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29)
#15 2.424   Profile: release
#15 2.442
#15 2.442 shell:
#15 2.442   bash
#15 2.442   GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
#15 2.442   Copyright (C) 2022 Free Software Foundation, Inc.
#15 2.442   License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
#15 2.442
#15 2.442   This is free software; you are free to change and redistribute it.
#15 2.442   There is NO WARRANTY, to the extent permitted by law.
#15 2.443
#15 2.443 dirs:
#15 2.443   data: ~/.local/share/mise
#15 2.443   config: ~/.config/mise
#15 2.443   cache: ~/.cache/mise
#15 2.443   state: ~/.local/state/mise
#15 2.443   shims: ~/.local/share/mise/shims
#15 2.457
#15 2.457 config_files:
#15 2.457
#15 2.457
#15 2.457 backends:
#15 2.457   cargo
#15 2.457   core
#15 2.457   go
#15 2.457   npm
#15 2.457   pipx
#15 2.457   spm
#15 2.457   ubi
#15 2.467
#15 2.467 plugins:
#15 2.467   bun     (core)
#15 2.467   deno    (core)
#15 2.467   erlang  (core)
#15 2.467   go      (core)
#15 2.467   java    (core)
#15 2.467   node    (core)
#15 2.467   python  (core)
#15 2.467   ruby    (core)
#15 2.476
#15 2.476 toolset:
#15 2.476
#15 2.477
#15 2.477 env_vars:
#15 2.477   MISE_SHELL=bash
#15 2.481
#15 2.481 settings:
#15 2.481   activate_aggressive = false
#15 2.481   all_compile = false
#15 2.481   always_keep_download = false
#15 2.481   always_keep_install = false
#15 2.481   asdf_compat = false
#15 2.481   cargo_binstall = true
#15 2.481   color = true
#15 2.481   disable_default_shorthands = false
#15 2.481   disable_tools = []
#15 2.481   experimental = false
#15 2.481   go_default_packages_file = "~/.default-go-packages"
#15 2.481   go_download_mirror = "https://dl.google.com/go"
#15 2.481   go_repo = "https://github.com/golang/go"
#15 2.481   go_set_gopath = false
#15 2.481   go_set_goroot = true
#15 2.481   go_skip_checksum = false
#15 2.481   http_timeout = 30
#15 2.481   jobs = 4
#15 2.481   legacy_version_file = true
#15 2.481   legacy_version_file_disable_tools = []
#15 2.481   node_compile = false
#15 2.481   not_found_auto_install = true
#15 2.481   paranoid = false
#15 2.481   plugin_autoupdate_last_check_duration = "7d"
#15 2.481   python_default_packages_file = "/home/appuser/.default-python-packages"
#15 2.481   python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
#15 2.481   raw = false
#15 2.481   trusted_config_paths = []
#15 2.481   quiet = false
#15 2.481   verbose = false
#15 2.481   yes = false
#15 2.481   ci = false
#15 2.481   debug = false
#15 2.481   trace = false
#15 2.481   log_level = "info"
#15 2.481   python_venv_auto_create = false
#15 2.481
#15 2.481   [status]
#15 2.481   missing_tools = "if_other_versions_installed"
#15 2.481   show_env = false
#15 2.481   show_tools = false
#15 2.481
#15 2.482 No warnings found
#15 2.482 No problems found
#15 2.484 + export MISE_VERBOSE=1
#15 2.484 + MISE_VERBOSE=1
#15 2.485 + RUST_BACKTRACE=full
#15 2.485 + mise --verbose use -g yq@latest
#15 2.485 + local command
#15 2.485 + command=--verbose
#15 2.485 + '[' 4 = 0 ']'
#15 2.485 + shift
#15 2.485 + case "$command" in
#15 2.485 + command mise --verbose use -g yq@latest
#15 2.586 [DEBUG] ARGS: mise --verbose use -g yq@latest
#15 2.597 [DEBUG] Config {
#15 2.597     Config Files: [],
#15 2.597 }
#15 2.599 [DEBUG] Toolset (295.458µs):
#15 2.605 [DEBUG] install_versions: yq@latest
#15 2.611 [WARN] ⚠️ yq is a community-developed plugin – https://github.com/sudermanjr/asdf-yq
#15 2.630 Error:
#15 2.631    0: yq is not installed
#15 2.631
#15 2.631 Location:
#15 2.631    src/backend/mod.rs:348
#15 2.631
#15 2.631 Version:
#15 2.631    2024.6.4 linux-x64 (e0e4107 2024-06-15)
#15 2.631
#15 2.631   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#15 2.632                                 ⋮ 2 frames hidden ⋮
#15 2.633    3: mise::backend::Backend::install_version::hc5ed94abc1750978
#15 2.633       at <unknown source file>:<unknown line>
#15 2.633    4: std::sys_common::backtrace::__rust_begin_short_backtrace::he638d8dff0100863
#15 2.633       at <unknown source file>:<unknown line>
#15 2.633    5: core::ops::function::FnOnce::call_once{{vtable.shim}}::h8b5462681d026c8a
#15 2.633       at <unknown source file>:<unknown line>
#15 2.633    6: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h19b9e642d37e7272
#15 2.633       at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020
#15 2.633    7: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h97265befc434d3ae
#15 2.633       at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020
#15 2.633    8: std::sys::pal::unix::thread::Thread::new::thread_start::h420dad5cf01a9f35
#15 2.633       at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys/pal/unix/thread.rs:108
#15 2.633    9: __clone<unknown>
#15 2.633       at <unknown source file>:<unknown line>
#15 2.633
#15 2.633 Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
#15 ERROR: process "/bin/sh -c bash -c \"app/installer.sh\"" did not complete successfully: exit code: 1
------
 > [ 9/10] RUN bash -c "app/installer.sh":
2.633    6: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h19b9e642d37e7272
2.633       at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020
2.633    7: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h97265befc434d3ae
2.633       at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020
2.633    8: std::sys::pal::unix::thread::Thread::new::thread_start::h420dad5cf01a9f35
2.633       at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys/pal/unix/thread.rs:108
2.633    9: __clone<unknown>
2.633       at <unknown source file>:<unknown line>
2.633
2.633 Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
------
Dockerfile:34
--------------------
  32 |     USER appuser
  33 |
  34 | >>> RUN bash -c "app/installer.sh"
  35 |     # RUN curl https://mise.run | sh
  36 |     # RUN echo 'eval "$(~/.local/bin/mise activate bash --shims)"' >> ~/.bashrc
--------------------
ERROR: failed to solve: process "/bin/sh -c bash -c \"app/installer.sh\"" did not complete successfully: exit code: 1
roele commented 2 weeks ago

The installer.sh script seems to fail for two reasons.

  1. it expects user input to confirm the use of a community developed plugin. pass a -y argument e.g. mise -y use -g yq@latest
  2. the yq seems to not install successfully, maybe an issue with the plugin? other tools such as jq seem to work fine.
  3. you might need to export LIBGIT2_NO_VENDOR=1 if mise has issues checking out repositories
ryan-dyer-sp commented 2 weeks ago

@roele The -y seems to have been the trick. Is this the case that all community plugins like this need a -y? All of the things i've been trying apparently are community plugins.
Thanks!

roele commented 2 weeks ago

Yes. Pretty much like with apt-get install you can skip interactive dialogs with a -y option. mise doctor shows you which are the core plugins (implemented in mise itself), everything else is treated as (asdf) community plugins and trigger a confirmation dialog.