Skip to main content

Step 1: Build the docker image for Eliza

Step 1.1: Clone the Eliza repository

  • Clone the Eliza repository from the GitHub repository.

    git clone https://github.com/elizaOS/eliza -b main

Note: The main branch is the latest stable version of the Eliza agent. If you want to use any other branch, make sure to checkout to the branch and that the builds on the branch are working as expected.

Step 1.2: Add the start.sh script

  • Add the below start.sh script to the root of the repository.

    #!/bin/bash

    # Start the Pulse Server for inserting secrets
    ./pulse-server --listen-addr 0.0.0.0:1600

    npm install -g [email protected] && \
    apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y \
    git \
    python3 \
    python3-pip \
    curl \
    node-gyp \
    ffmpeg \
    libtool-bin \
    autoconf \
    automake \
    libopus-dev \
    make \
    g++ \
    build-essential \
    libcairo2-dev \
    libjpeg-dev \
    libpango1.0-dev \
    libgif-dev \
    openssl \
    libssl-dev && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

    # Install dependencies
    pnpm install --no-frozen-lockfile

    # Build the project
    pnpm run build

    # Start the application
    # Example without a character:
    # pnpm start
    npx concurrently "pnpm start --character=\"characters/trump.character.json\"" \
    "pnpm start:client --host"

Note: You should paste your characters in the characters directory and load them by adding their path in the above script. You can find some default characters in the characters directory of the Eliza repository.

You can modify the start.sh script to start with a character, or any other configurations Eliza offers. Please go through the Eliza documentation for more details.

Step 1.3: Add the .dockerignore file

  • Add the following .dockerignore file to the root of the repository.

    .editorconfig
    .git
    .gitignore
    .vscode

    # Docker-related files
    Dockerfile*
    docker-compose*.yml
    .dockerignore

    *.tar

    *README*
    *.md

    LICENSE

    *.env
    *.example

    *node_modules*
    *dist*
    *build*
    *.turbo

    *logs*

    tests/

    result/

Step 1.4: Add the DockerfileOyster file

  • Add the DockerfileOyster file to the root of the repository.

    # Get the Pulse Server for secrets
    FROM rust:1.84-slim AS pulse-builder

    RUN apt-get update && \
    apt-get install -y git make && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

    WORKDIR /app

    RUN git clone https://github.com/marlinprotocol/oyster-monorepo.git -b roshan/pulse
    WORKDIR /app/oyster-monorepo/initialization/pulse
    RUN cargo build --release

    FROM node:23.3.0-slim

    WORKDIR /app

    COPY . .

    COPY ./start.sh ./start.sh
    RUN chmod +x ./start.sh

    COPY --from=pulse-builder /app/oyster-monorepo/initialization/pulse/target/release/pulse-server ./

    RUN chmod +x ./pulse-server

    CMD ["./start.sh"]

Step 1.5: Modify BASE_URL if you want to run the client inside the enclave.

Note: This is optional and only required if you want to run the client inside the enclave. For just running the Agent server without the client, you can skip this step.

Note: If you do not want the client inside the enclave, you can also modify the .dockerignore file to remove the client directory and the pnpm start:client --host command in the start.sh script.

  • Modify the BASE_URL in the client/src/lib/api.ts file in L#3 to fetch the IP Address from the client page.

    const BASE_URL = `${window.location.protocol}//${window.location.hostname}:3000`;

Step 1.6: Build the docker image

  • Build the docker image using the following command:

    docker build -t eliza . -f DockerfileOyster

Step 1.7: Update the docker-compose-oyster.yaml file

  • Update the docker-compose-oyster.yaml file for the Oyster CVM to use the new docker image.

    services:
    eliza:
    image: eliza:latest
    init: true
    network_mode: host
    restart: unless-stopped
    volumes:
    - /app/id.sec:/app/id.sec

Step 1.8: Update the .env file

  • Create a .env file in the root of the repository, if not already present.

    Eliza provides a .env.example file in the root of the repository. You can use this file to create a .env file in the root of the repository.

    cp .env.example .env
  • Add/Update the following environment variables in the .env file:

    TEE_MARLIN=yes
    TEE_MARLIN_ATTESTATION_ENDPOINT=http://127.0.0.1:1300
    OPENAI_API_KEY=<your_openai_api_key>
  • TEE_MARLIN env variable is required for the enclave to be able to interact with the attestation service inside the Oyster Enclave.

  • TEE_MARLIN_ATTESTATION_ENDPOINT is the endpoint for the attestation service inside the Oyster Enclave.

  • OPENAI_API_KEY is required for most characters in Eliza, depending on the character you choose.

Note: You can add other secrets as needed and required by the Eliza agent, like OPENAI_API_KEY, etc.