diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..e5deb93b1df --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,24 @@ +ARG NODE_VER=23.5.0 +ARG BASE_IMAGE=node:${NODE_VER} +FROM $BASE_IMAGE + +ENV DEBIAN_FRONTEND=noninteractive + +# Install pnpm globally and install necessary build tools +RUN apt-get update \ + && apt-get install -y \ + git \ + python3 \ + make \ + g++ \ + nano \ + vim \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ARG PNPM_VER=9.15.2 +RUN npm install -g pnpm@${PNPM_VER} + +# Set Python 3 as the default python +RUN ln -s /usr/bin/python3 /usr/bin/python +ENV DEBIAN_FRONTEND=dialog diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..23aca531b45 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,38 @@ +// See https://aka.ms/vscode-remote/devcontainer.json for format details. +{ + "name": "elizaos-dev", + "dockerFile": "Dockerfile", + "build": { + "args": { + "NODE_VER": "23.5.0", + "PNPM_VER": "9.15.2" + } + }, + "privileged": true, + "runArgs": [ + "-p=3000:3000", // Add port for server api + "-p=5173:5173", // Add port for client + //"--volume=/usr/lib/wsl:/usr/lib/wsl", // uncomment for WSL + //"--volume=/mnt/wslg:/mnt/wslg", // uncomment for WSL + "--gpus=all", // ! uncomment for vGPU + //"--device=/dev/dxg", // uncomment this for vGPU under WSL + "--device=/dev/dri" + ], + "containerEnv": { + //"MESA_D3D12_DEFAULT_ADAPTER_NAME": "NVIDIA", // uncomment for WSL + //"LD_LIBRARY_PATH": "/usr/lib/wsl/lib" // uncomment for WSL + }, + "customizations": { + "vscode": { + "extensions": [ + "vscode.json-language-features", + "vscode.css-language-features", + // "foxundermoon.shell-format", + // "dbaeumer.vscode-eslint", + // "esbenp.prettier-vscode" + "ms-python.python" + ] + } + }, + "features": {} +} \ No newline at end of file diff --git a/docs/docs/guides/local-development.md b/docs/docs/guides/local-development.md index d988dd1b83b..50a189918f6 100644 --- a/docs/docs/guides/local-development.md +++ b/docs/docs/guides/local-development.md @@ -8,29 +8,53 @@ This guide covers setting up and working with Eliza in a development environment ## Prerequisites -Before you begin, ensure you have: +You can develop either in a **dev container** or directly on your **host machine**. + +### Requirements: ```bash # Required -Node.js 23+ -pnpm +Node.js (v23+; not required if using the dev container) +pnpm (not required if using the dev container) Git -# Optional but recommended -VS Code -Docker (for database development) -CUDA Toolkit (for GPU acceleration) +VS Code (mandatory for using the dev container or coding) +Docker (mandatory for using the dev container or database development) +CUDA Toolkit (optional, for GPU acceleration) ``` ## Initial Setup ### 1. Repository Setup +Clone the repository and navigate to the project directory: + ```bash # Clone the repository git clone https://github.com/elizaos/eliza.git cd eliza +``` + +### 2. (Optional) Run Inside a Dev Container + +1. Open the project directory in **VS Code**: + ```bash + code . + ``` + +2. In the bottom-right corner, you'll see a popup: + **"Reopen in Container"** – Click it. + + - If you don't see the popup or miss it, press `F1`, type: + **"Reopen in Container"**, and select it. + +3. Wait for the container to initialize. +4. Open a terminal (hotkey: `Ctrl+Shift+\``) and run commands from the **container terminal** going forward. + +### 3. Setup dependencies + +```bash # Install dependencies pnpm install @@ -38,7 +62,7 @@ pnpm install pnpm install --include=optional sharp ``` -### 2. Environment Configuration +### 4. Environment Configuration Create your development environment file: @@ -56,7 +80,7 @@ XAI_API_KEY= # Leave blank for local inference XAI_MODEL=meta-llama/Llama-3.1-7b-instruct # Local model ``` -### 3. Local Model Setup +### 5. Local Model Setup For local inference without API dependencies: @@ -106,10 +130,16 @@ pnpm run dev --characters="characters/my-character.json" pnpm start:client ``` +NOTE: If you are using devcontainer, add --host argument to client: +``` +pnpm start:client --host +``` + Look for the message: ` ➜ Local: http://localhost:5173/` Click on that link or open a browser window to that location. Once you do that you should see the chat interface connect with the system and you can start interacting with your character. + ## Database Development ### SQLite (Recommended for Development)