From 80cec5014696227d7a1ae411493b82ecd0f9aaaa Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Sun, 19 Jan 2025 17:45:47 -0800 Subject: [PATCH] chore: add openhands support --- docker/workspace/Dockerfile | 28 ++++++++++++++++++++++++ docker/workspace/Dockerfile.dockerignore | 2 ++ scripts/ai/run_openhands.sh | 15 +++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 docker/workspace/Dockerfile create mode 100644 docker/workspace/Dockerfile.dockerignore create mode 100755 scripts/ai/run_openhands.sh diff --git a/docker/workspace/Dockerfile b/docker/workspace/Dockerfile new file mode 100644 index 0000000000..c2a7061eea --- /dev/null +++ b/docker/workspace/Dockerfile @@ -0,0 +1,28 @@ +FROM debian:12.9 + +RUN apt-get update && apt-get install -y \ + curl \ + sudo \ + xz-utils \ + && rm -rf /var/lib/apt/lists/* + +RUN echo '#!/bin/bash\nexec nix-shell /app/shell.nix "$@"' > /usr/local/bin/nix-shell-wrapper && chmod +x /usr/local/bin/nix-shell-wrapper + +RUN useradd -m nixuser && echo "nixuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nixuser + +USER nixuser + +RUN curl -vL https://nixos.org/nix/install | sh + +ENV USER nixuser +ENV PATH /home/nixuser/.nix-profile/bin:/home/nixuser/.nix-profile/sbin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:$PATH +ENV NIX_PATH /nix/var/nix/profiles/per-user/nixuser/channels + +WORKDIR /app + +COPY --chown=nixuser:nixuser shell.nix /app/ + +RUN nix-shell shell.nix --run "true" + +ENTRYPOINT ["/usr/local/bin/nix-shell-wrapper"] + diff --git a/docker/workspace/Dockerfile.dockerignore b/docker/workspace/Dockerfile.dockerignore new file mode 100644 index 0000000000..559656bc90 --- /dev/null +++ b/docker/workspace/Dockerfile.dockerignore @@ -0,0 +1,2 @@ +* +!shell.nix diff --git a/scripts/ai/run_openhands.sh b/scripts/ai/run_openhands.sh new file mode 100755 index 0000000000..4dd46afc3a --- /dev/null +++ b/scripts/ai/run_openhands.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# TODO: build image +# TODO: connect image + +docker run -it --rm --pull=always \ + -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.20-nikolaik \ + -e LOG_ALL_EVENTS=true \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v ~/.openhands-state:/.openhands-state \ + -p 3500:3000 \ + --add-host host.docker.internal:host-gateway \ + --name rivet-openhands \ + docker.all-hands.dev/all-hands-ai/openhands:0.20 +