From 61ecb58d366567746a2f2098f353388e90ee95be Mon Sep 17 00:00:00 2001 From: Dave Sargent Date: Mon, 28 Oct 2024 17:18:23 -0700 Subject: [PATCH] Install mise from a docker file as the security tooling was not likeing the install mise script not being version locked. --- Dockerfile | 13 +++++++------ home/vscode/.bashrc | 2 +- home/vscode/.zshrc | 4 ++-- scripts/10_install_system_packages.sh | 2 +- ..._install_mise.sh => 30_install_mise_packages.sh} | 6 +++--- scripts/40_install_other_apps.sh | 5 +++-- 6 files changed, 17 insertions(+), 15 deletions(-) rename scripts/{30_install_mise.sh => 30_install_mise_packages.sh} (78%) diff --git a/Dockerfile b/Dockerfile index 685fe61..2e34ce8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,9 @@ # home/vscode/.config/mise/config.toml # Add custom Mise tools and version to your projects root as .mist.toml See: https://mise.jdx.dev/configuration.html -FROM rockylinux:9@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 +FROM jdxcode/mise@sha256:a9f92f8ddaf6450359cf0fd40fb36dd4e9be8b419a3c17305164497cace8af16 AS mise + +FROM rockylinux:9@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 AS final LABEL org.opencontainers.image.source=https://github.com/sarg3nt/go-dev-container @@ -33,6 +35,9 @@ RUN /scripts/20_install_microsoft_dev_container_features.sh # Set current user to the vscode user, run all future commands as this user. USER vscode +# Copy the mise binary from the mise container +COPY --from=mise /usr/local/bin/mise /usr/local/bin/mise + # Install applications that are scoped to the vscode user RUN sudo chown vscode /scripts @@ -43,15 +48,11 @@ COPY --chown=vscode:vscode home/vscode/.config/mise /home/vscode/.config/mise ARG MISE_VERBOSE=0 ARG RUST_BACKTRACE=0 # https://github.com/jdx/mise/releases -# Passed from the .devcontainer/devcontainer.json file, static version here to use as a default. -ARG MISE_VERSION="v2024.10.8" -RUN /scripts/30_install_mise.sh +RUN /scripts/30_install_mise_packages.sh # https://github.com/go-delve/delve/releases -# Passed from the .devcontainer/devcontainer.json file, static version here to use as a default. ARG GO_DELVE_DLV_VERSION="1.23.1" # https://github.com/mvdan/gofumpt/releases -# Passed from the .devcontainer/devcontainer.json file, static version here to use as a default. ARG GO_FUMPT_VERSION="0.7.0" RUN /scripts/40_install_other_apps.sh diff --git a/home/vscode/.bashrc b/home/vscode/.bashrc index ee9abbb..1b0dcd5 100644 --- a/home/vscode/.bashrc +++ b/home/vscode/.bashrc @@ -93,7 +93,7 @@ alias help="/usr/local/bin/help" [ -f ~/.fzf.bash ] && source ~/.fzf.bash # Active mise -eval "$(~/.local/bin/mise activate bash)" +eval "$(/usr/local/bin/mise activate bash)" mie trust --all mise install --yes diff --git a/home/vscode/.zshrc b/home/vscode/.zshrc index 27a82d9..2f37b11 100644 --- a/home/vscode/.zshrc +++ b/home/vscode/.zshrc @@ -159,8 +159,8 @@ source "$HOME/.fzf-key-bindings.zsh" source "$HOME/.fzf-completion.zsh" # Active mise -eval "$(~/.local/bin/mise activate zsh)" -mie trust --all +eval "$(/usr/local/bin/mise activate zsh)" +mise trust --all mise install --yes help diff --git a/scripts/10_install_system_packages.sh b/scripts/10_install_system_packages.sh index 6cd449d..4c06d7b 100755 --- a/scripts/10_install_system_packages.sh +++ b/scripts/10_install_system_packages.sh @@ -8,7 +8,7 @@ IFS=$'\n\t' # Install system packages main() { source "/usr/bin/lib/sh/log.sh" - log "10-install-system-packages.sh" "blue" + log "10_install_system_packages.sh" "blue" log "Adding install_weak_deps=False to /etc/dnf/dnf.conf" "green" echo "install_weak_deps=False" >>/etc/dnf/dnf.conf diff --git a/scripts/30_install_mise.sh b/scripts/30_install_mise_packages.sh similarity index 78% rename from scripts/30_install_mise.sh rename to scripts/30_install_mise_packages.sh index 983ab38..6aae23a 100755 --- a/scripts/30_install_mise.sh +++ b/scripts/30_install_mise_packages.sh @@ -7,10 +7,10 @@ main() { source "/usr/bin/lib/sh/log.sh" ############ Install mise - log "30-install-mise.sh" "blue" + log "30_install_mise_packages.sh" "blue" - log "Installing mise" "green" - curl -sL https://mise.run | sh + # Mise is installed in the docker file from it's master docker branch. + log "Configuring mise" "green" export PATH="$HOME/.local/share/mise/shims:$HOME/.local/bin/:$PATH" log "Mise version" "green" diff --git a/scripts/40_install_other_apps.sh b/scripts/40_install_other_apps.sh index b9f0d1f..22cc210 100755 --- a/scripts/40_install_other_apps.sh +++ b/scripts/40_install_other_apps.sh @@ -9,7 +9,7 @@ main() { source "/usr/bin/lib/sh/log.sh" export PATH="$HOME/.local/share/mise/shims:$HOME/.local/bin/:$PATH" - log "50-install-other-apps.sh" "blue" + log "40_install_other_apps.sh" "blue" add_go_tools add_vscode_extensions_cache @@ -25,7 +25,8 @@ add_go_tools() { log "Adding Go Tools" "green" go install "github.com/go-delve/delve/cmd/dlv@v${GO_DELVE_DLV_VERSION}" go install "mvdan.cc/gofumpt@v${GO_FUMPT_VERSION}" - go install golang.org/x/tools/gopls@latest + # gopls is installed by the go plugin + #go install golang.org/x/tools/gopls@latest # TODO: Find it if this is still needed and remove if not. #echo "golang:x:999:vscode" | sudo tee -a /etc/group