mirror of
https://github.com/getcompanion-ai/computer-guest.git
synced 2026-04-15 03:00:42 +00:00
feat: phase 1
This commit is contained in:
parent
2b2ece6778
commit
c74c1a676c
2 changed files with 27 additions and 1 deletions
15
Dockerfile
15
Dockerfile
|
|
@ -1,3 +1,15 @@
|
|||
FROM --platform=$BUILDPLATFORM golang:1.26.1 AS guestd-builder
|
||||
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
COPY packages/guestd ./packages/guestd
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} go build -o /out/microagent-guestd ./packages/guestd/cmd/guestd
|
||||
|
||||
FROM public.ecr.aws/docker/library/ubuntu:24.04
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
|
@ -133,6 +145,7 @@ COPY microagent-init.sh /usr/local/bin/microagent-init
|
|||
COPY microagent-desktop-session.sh /usr/local/bin/microagent-desktop-session
|
||||
COPY microagent-network-up.sh /usr/local/bin/microagent-network-up
|
||||
COPY microagent-ready-agent.py /usr/local/bin/microagent-ready-agent
|
||||
COPY --from=guestd-builder /out/microagent-guestd /usr/local/bin/microagent-guestd
|
||||
COPY defaults/.zshrc /home/node/.zshrc
|
||||
COPY defaults/.bashrc /home/node/.bashrc
|
||||
COPY defaults/.profile /home/node/.profile
|
||||
|
|
@ -141,7 +154,7 @@ COPY defaults/AGENTS.md /home/node/AGENTS.md
|
|||
COPY terminfo/xterm-ghostty.terminfo /tmp/xterm-ghostty.terminfo
|
||||
COPY terminfo/xterm-kitty.terminfo /tmp/xterm-kitty.terminfo
|
||||
|
||||
RUN chmod 755 /usr/local/bin/microagent-init /usr/local/bin/microagent-desktop-session /usr/local/bin/microagent-network-up /usr/local/bin/microagent-ready-agent \
|
||||
RUN chmod 755 /usr/local/bin/microagent-init /usr/local/bin/microagent-desktop-session /usr/local/bin/microagent-network-up /usr/local/bin/microagent-ready-agent /usr/local/bin/microagent-guestd \
|
||||
&& chmod 755 /opt/desktop/scripts/apply-desktop-profile.sh \
|
||||
&& chown node:node /home/node/.zshrc /home/node/.bashrc /home/node/.profile /home/node/AGENTS.md \
|
||||
&& ln -sf /home/node/AGENTS.md /home/node/CLAUDE.md \
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ cleanup() {
|
|||
[ -n "${ready_agent_pid:-}" ] && kill "$ready_agent_pid" >/dev/null 2>&1 || true
|
||||
[ -n "${sshd_pid:-}" ] && kill "$sshd_pid" >/dev/null 2>&1 || true
|
||||
[ -n "${desktop_pid:-}" ] && kill "$desktop_pid" >/dev/null 2>&1 || true
|
||||
[ -n "${guestd_pid:-}" ] && kill "$guestd_pid" >/dev/null 2>&1 || true
|
||||
wait >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
}
|
||||
|
|
@ -75,6 +76,13 @@ start_desktop() {
|
|||
desktop_pid=$!
|
||||
}
|
||||
|
||||
start_guestd() {
|
||||
reap_if_needed "${guestd_pid:-}"
|
||||
log "starting guestd on 49983"
|
||||
/usr/local/bin/microagent-guestd >>/var/log/guestd.log 2>&1 &
|
||||
guestd_pid=$!
|
||||
}
|
||||
|
||||
trap cleanup INT TERM
|
||||
|
||||
log "bringing up guest network"
|
||||
|
|
@ -125,6 +133,7 @@ fi
|
|||
start_ready_agent
|
||||
start_sshd
|
||||
start_desktop
|
||||
start_guestd
|
||||
|
||||
while true; do
|
||||
if ! pid_running "${ready_agent_pid:-}"; then
|
||||
|
|
@ -139,5 +148,9 @@ while true; do
|
|||
log "desktop session exited; restarting"
|
||||
start_desktop
|
||||
fi
|
||||
if ! pid_running "${guestd_pid:-}"; then
|
||||
log "guestd exited; restarting"
|
||||
start_guestd
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue