Skip to content

Commit

Permalink
add devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzvaz committed Jan 4, 2025
1 parent af2b2c5 commit 5c4f0a3
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 9 deletions.
24 changes: 24 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
48 changes: 39 additions & 9 deletions docs/docs/guides/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,61 @@ 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
# Install optional dependencies
pnpm install --include=optional sharp
```
### 2. Environment Configuration
### 4. Environment Configuration
Create your development environment file:
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5c4f0a3

Please sign in to comment.