From 63b6a452b0d2150d22816e82408cd1d564c42f75 Mon Sep 17 00:00:00 2001 From: Hari <73809867+harivansh-afk@users.noreply.github.com> Date: Wed, 8 Apr 2026 17:38:27 -0400 Subject: [PATCH] feat: preloaded-packages and bundle (#5) --- Dockerfile | 55 +++++++++++++++++++++++++++++++++++++++++----- defaults/.bashrc | 4 ++++ defaults/.zshrc | 21 +++++++++++++++++- microagent-init.sh | 5 ++++- 4 files changed, 77 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4ede349..8faab11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,23 +3,62 @@ FROM public.ecr.aws/docker/library/ubuntu:24.04 SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV DEBIAN_FRONTEND=noninteractive -ARG MICROAGENT_TEST_AUTHORIZED_KEY="" +ENV EDITOR=nvim \ + VISUAL=nvim RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ + gnupg \ + && mkdir -p /etc/apt/keyrings \ + && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ + && printf '%s\n' "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + bat \ + build-essential \ dbus-x11 \ + dnsutils \ eza \ + fd-find \ + file \ fonts-dejavu-core \ + fzf \ + gh \ git \ + iputils-ping \ iproute2 \ jitterentropy-rngd \ + jq \ + just \ + less \ + lsof \ + make \ + man-db \ + manpages \ + netcat-openbsd \ net-tools \ ncurses-bin \ + neovim \ + nodejs \ novnc \ openbox \ openssh-server \ + pipx \ + procps \ + python3 \ + python3-pip \ + python3-venv \ + ripgrep \ + rsync \ + shellcheck \ + sqlite3 \ sudo \ + tmux \ + tree \ + unzip \ + wget \ + xz-utils \ zsh \ zsh-autosuggestions \ zsh-syntax-highlighting \ @@ -39,7 +78,11 @@ RUN useradd --create-home --shell /bin/bash node \ && usermod -aG sudo node \ && printf 'node ALL=(ALL) NOPASSWD:ALL\n' >/etc/sudoers.d/node \ && chmod 440 /etc/sudoers.d/node \ - && install -d -m 0755 /etc/microagent + && install -d -m 0755 /etc/microagent \ + && ln -sf /usr/bin/fdfind /usr/local/bin/fd \ + && ln -sf /usr/bin/batcat /usr/local/bin/bat \ + && ln -sf /usr/bin/nvim /usr/local/bin/vim \ + && ln -sf /usr/bin/nvim /usr/local/bin/vi COPY docker/guest/sshd_config /etc/ssh/sshd_config COPY docker/guest/microagent-init.sh /usr/local/bin/microagent-init @@ -62,9 +105,9 @@ RUN chmod 755 /usr/local/bin/microagent-init /usr/local/bin/microagent-desktop-s && tic -x -o /usr/share/terminfo /tmp/xterm-kitty.terminfo \ && rm -f /tmp/xterm-ghostty.terminfo /tmp/xterm-kitty.terminfo -RUN if [ -n "$MICROAGENT_TEST_AUTHORIZED_KEY" ]; then \ - printf '%s\n' "$MICROAGENT_TEST_AUTHORIZED_KEY" >/etc/microagent/authorized_keys; \ - chmod 600 /etc/microagent/authorized_keys; \ - fi +RUN npm install -g \ + @anthropic-ai/claude-code \ + @openai/codex \ + && npm cache clean --force CMD ["/usr/local/bin/microagent-init"] diff --git a/defaults/.bashrc b/defaults/.bashrc index 80d7a17..2fdfd55 100644 --- a/defaults/.bashrc +++ b/defaults/.bashrc @@ -7,6 +7,10 @@ computer_prompt_name() { printf '%s' "${COMPUTER_NAME:-${COMPUTER_HANDLE:-microagentcomputer}}" } +export EDITOR="${EDITOR:-nvim}" +export VISUAL="${VISUAL:-nvim}" +alias vim='nvim' +alias vi='nvim' alias ls='eza --group-directories-first --icons=auto' alias la='eza -a --group-directories-first --icons=auto' alias ll='eza -lah --git --group-directories-first --icons=auto' diff --git a/defaults/.zshrc b/defaults/.zshrc index a2ddb15..65fab3d 100644 --- a/defaults/.zshrc +++ b/defaults/.zshrc @@ -7,13 +7,31 @@ setopt extended_history setopt hist_ignore_all_dups setopt hist_reduce_blanks setopt share_history +setopt prompt_subst bindkey -v +bindkey '^?' backward-delete-char computer_prompt_name() { printf '%s' "${COMPUTER_NAME:-${COMPUTER_HANDLE:-microagentcomputer}}" } +ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/zsh" +export ZSH_COMPDUMP="${ZSH_COMPDUMP:-$ZSH_CACHE_DIR/.zcompdump}" +mkdir -p "$ZSH_CACHE_DIR" 2>/dev/null || true + +autoload -Uz compinit +zmodload zsh/complist 2>/dev/null || true +if [ -s "$ZSH_COMPDUMP" ]; then + compinit -C -d "$ZSH_COMPDUMP" +else + compinit -d "$ZSH_COMPDUMP" +fi + +export EDITOR="${EDITOR:-nvim}" +export VISUAL="${VISUAL:-nvim}" +alias vim='nvim' +alias vi='nvim' alias ls='eza --group-directories-first --icons=auto' alias la='eza -a --group-directories-first --icons=auto' alias ll='eza -lah --git --group-directories-first --icons=auto' @@ -33,7 +51,8 @@ if [ -r /opt/zsh/pure/pure.zsh ] && [ -r /opt/zsh/pure/async.zsh ]; then promptinit if prompt pure >/dev/null 2>&1; then zstyle ':prompt:pure:path' color blue - PROMPT='%F{green}$(computer_prompt_name)%f ${PROMPT}' + pure_prompt="$PROMPT" + PROMPT='%F{green}$(computer_prompt_name)%f '"$pure_prompt" else PROMPT='%F{green}$(computer_prompt_name)%f %F{blue}%~%f %# ' fi diff --git a/microagent-init.sh b/microagent-init.sh index 02ed89a..799a148 100644 --- a/microagent-init.sh +++ b/microagent-init.sh @@ -10,6 +10,9 @@ log() { mountpoint -q /proc || mount -t proc proc /proc mountpoint -q /sys || mount -t sysfs sysfs /sys mountpoint -q /dev || mount -t devtmpfs devtmpfs /dev +mkdir -p /dev/pts /dev/shm +mountpoint -q /dev/pts || mount -t devpts devpts /dev/pts -o mode=620,ptmxmode=666,gid=5 +mountpoint -q /dev/shm || mount -t tmpfs tmpfs /dev/shm mountpoint -q /run || mount -t tmpfs tmpfs /run mkdir -p /tmp /var/tmp /run/sshd /var/log @@ -64,7 +67,7 @@ if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then fi if [ -f /etc/microagent/authorized_keys ]; then - log "installing baked authorized_keys for node" + log "installing injected authorized_keys for node" install -d -m 0700 -o node -g node /home/node/.ssh install -m 0600 -o node -g node /etc/microagent/authorized_keys /home/node/.ssh/authorized_keys fi