mirror of
https://github.com/getcompanion-ai/computer-guest.git
synced 2026-04-15 07:04:43 +00:00
feat: preloaded-packages and bundle (#5)
This commit is contained in:
parent
09c9671fcb
commit
63b6a452b0
4 changed files with 77 additions and 8 deletions
55
Dockerfile
55
Dockerfile
|
|
@ -3,23 +3,62 @@ FROM public.ecr.aws/docker/library/ubuntu:24.04
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
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 \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
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 \
|
dbus-x11 \
|
||||||
|
dnsutils \
|
||||||
eza \
|
eza \
|
||||||
|
fd-find \
|
||||||
|
file \
|
||||||
fonts-dejavu-core \
|
fonts-dejavu-core \
|
||||||
|
fzf \
|
||||||
|
gh \
|
||||||
git \
|
git \
|
||||||
|
iputils-ping \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
jitterentropy-rngd \
|
jitterentropy-rngd \
|
||||||
|
jq \
|
||||||
|
just \
|
||||||
|
less \
|
||||||
|
lsof \
|
||||||
|
make \
|
||||||
|
man-db \
|
||||||
|
manpages \
|
||||||
|
netcat-openbsd \
|
||||||
net-tools \
|
net-tools \
|
||||||
ncurses-bin \
|
ncurses-bin \
|
||||||
|
neovim \
|
||||||
|
nodejs \
|
||||||
novnc \
|
novnc \
|
||||||
openbox \
|
openbox \
|
||||||
openssh-server \
|
openssh-server \
|
||||||
|
pipx \
|
||||||
|
procps \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
|
python3-venv \
|
||||||
|
ripgrep \
|
||||||
|
rsync \
|
||||||
|
shellcheck \
|
||||||
|
sqlite3 \
|
||||||
sudo \
|
sudo \
|
||||||
|
tmux \
|
||||||
|
tree \
|
||||||
|
unzip \
|
||||||
|
wget \
|
||||||
|
xz-utils \
|
||||||
zsh \
|
zsh \
|
||||||
zsh-autosuggestions \
|
zsh-autosuggestions \
|
||||||
zsh-syntax-highlighting \
|
zsh-syntax-highlighting \
|
||||||
|
|
@ -39,7 +78,11 @@ RUN useradd --create-home --shell /bin/bash node \
|
||||||
&& usermod -aG sudo node \
|
&& usermod -aG sudo node \
|
||||||
&& printf 'node ALL=(ALL) NOPASSWD:ALL\n' >/etc/sudoers.d/node \
|
&& printf 'node ALL=(ALL) NOPASSWD:ALL\n' >/etc/sudoers.d/node \
|
||||||
&& chmod 440 /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/sshd_config /etc/ssh/sshd_config
|
||||||
COPY docker/guest/microagent-init.sh /usr/local/bin/microagent-init
|
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 \
|
&& tic -x -o /usr/share/terminfo /tmp/xterm-kitty.terminfo \
|
||||||
&& rm -f /tmp/xterm-ghostty.terminfo /tmp/xterm-kitty.terminfo
|
&& rm -f /tmp/xterm-ghostty.terminfo /tmp/xterm-kitty.terminfo
|
||||||
|
|
||||||
RUN if [ -n "$MICROAGENT_TEST_AUTHORIZED_KEY" ]; then \
|
RUN npm install -g \
|
||||||
printf '%s\n' "$MICROAGENT_TEST_AUTHORIZED_KEY" >/etc/microagent/authorized_keys; \
|
@anthropic-ai/claude-code \
|
||||||
chmod 600 /etc/microagent/authorized_keys; \
|
@openai/codex \
|
||||||
fi
|
&& npm cache clean --force
|
||||||
|
|
||||||
CMD ["/usr/local/bin/microagent-init"]
|
CMD ["/usr/local/bin/microagent-init"]
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@ computer_prompt_name() {
|
||||||
printf '%s' "${COMPUTER_NAME:-${COMPUTER_HANDLE:-microagentcomputer}}"
|
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 ls='eza --group-directories-first --icons=auto'
|
||||||
alias la='eza -a --group-directories-first --icons=auto'
|
alias la='eza -a --group-directories-first --icons=auto'
|
||||||
alias ll='eza -lah --git --group-directories-first --icons=auto'
|
alias ll='eza -lah --git --group-directories-first --icons=auto'
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,31 @@ setopt extended_history
|
||||||
setopt hist_ignore_all_dups
|
setopt hist_ignore_all_dups
|
||||||
setopt hist_reduce_blanks
|
setopt hist_reduce_blanks
|
||||||
setopt share_history
|
setopt share_history
|
||||||
|
setopt prompt_subst
|
||||||
|
|
||||||
bindkey -v
|
bindkey -v
|
||||||
|
bindkey '^?' backward-delete-char
|
||||||
|
|
||||||
computer_prompt_name() {
|
computer_prompt_name() {
|
||||||
printf '%s' "${COMPUTER_NAME:-${COMPUTER_HANDLE:-microagentcomputer}}"
|
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 ls='eza --group-directories-first --icons=auto'
|
||||||
alias la='eza -a --group-directories-first --icons=auto'
|
alias la='eza -a --group-directories-first --icons=auto'
|
||||||
alias ll='eza -lah --git --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
|
promptinit
|
||||||
if prompt pure >/dev/null 2>&1; then
|
if prompt pure >/dev/null 2>&1; then
|
||||||
zstyle ':prompt:pure:path' color blue
|
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
|
else
|
||||||
PROMPT='%F{green}$(computer_prompt_name)%f %F{blue}%~%f %# '
|
PROMPT='%F{green}$(computer_prompt_name)%f %F{blue}%~%f %# '
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ log() {
|
||||||
mountpoint -q /proc || mount -t proc proc /proc
|
mountpoint -q /proc || mount -t proc proc /proc
|
||||||
mountpoint -q /sys || mount -t sysfs sysfs /sys
|
mountpoint -q /sys || mount -t sysfs sysfs /sys
|
||||||
mountpoint -q /dev || mount -t devtmpfs devtmpfs /dev
|
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
|
mountpoint -q /run || mount -t tmpfs tmpfs /run
|
||||||
|
|
||||||
mkdir -p /tmp /var/tmp /run/sshd /var/log
|
mkdir -p /tmp /var/tmp /run/sshd /var/log
|
||||||
|
|
@ -64,7 +67,7 @@ if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/microagent/authorized_keys ]; then
|
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 -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
|
install -m 0600 -o node -g node /etc/microagent/authorized_keys /home/node/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue