From 62fbe4c6223fef3cce311b7245f23bbd1cfc2c84 Mon Sep 17 00:00:00 2001 From: Graham Neubig Date: Fri, 17 Jan 2025 16:05:41 -0500 Subject: [PATCH] docs: improve custom sandbox guide with more configuration options (#5589) Co-authored-by: openhands --- .../usage/how-to/custom-sandbox-guide.md | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/modules/usage/how-to/custom-sandbox-guide.md b/docs/modules/usage/how-to/custom-sandbox-guide.md index 154e1117ae66..a01d7c401b84 100644 --- a/docs/modules/usage/how-to/custom-sandbox-guide.md +++ b/docs/modules/usage/how-to/custom-sandbox-guide.md @@ -18,15 +18,21 @@ If you choose the first option, you can skip the `Create Your Docker Image` sect To create a custom Docker image, it must be Debian based. -For example, if you want OpenHands to have `ruby` installed, create a `Dockerfile` with the following content: +For example, if you want OpenHands to have `ruby` installed, you could create a `Dockerfile` with the following content: ```dockerfile -FROM debian:latest +FROM nikolaik/python-nodejs:python3.12-nodejs22 # Install required packages RUN apt-get update && apt-get install -y ruby ``` +Or you could use a Ruby-specific base image: + +```dockerfile +FROM ruby:latest +``` + Save this file in a folder. Then, build your Docker image (e.g., named custom-image) by navigating to the folder in the terminal and running:: ```bash @@ -55,6 +61,28 @@ This can be an image you’ve already pulled or one you’ve built: sandbox_base_container_image="custom-image" ``` +### Additional Configuration Options + +The `config.toml` file supports several other options for customizing your sandbox: + +```toml +[core] +# Install additional dependencies when the runtime is built +# Can contain any valid shell commands +# If you need the path to the Python interpreter in any of these commands, you can use the $OH_INTERPRETER_PATH variable +runtime_extra_deps = """ +pip install numpy pandas +apt-get update && apt-get install -y ffmpeg +""" + +# Set environment variables for the runtime +# Useful for configuration that needs to be available at runtime +runtime_startup_env_vars = { DATABASE_URL = "postgresql://user:pass@localhost/db" } + +# Specify platform for multi-architecture builds (e.g., "linux/amd64" or "linux/arm64") +platform = "linux/amd64" +``` + ### Run Run OpenHands by running ```make run``` in the top level directory.