Skip to content

Commit

Permalink
Merge pull request elizaOS#83 from HashWarlock/main
Browse files Browse the repository at this point in the history
fix docker issue and add docker compose files
  • Loading branch information
wtfsayo authored Jan 16, 2025
2 parents 817dfb0 + ea70539 commit 61e4c41
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
FROM node:23.3.0-slim AS builder

# Install pnpm globally and install necessary build tools
RUN npm install -g pnpm@9.15.1
RUN apt-get update && \
RUN npm install -g pnpm@9.15.1 && \
apt-get update && \
apt-get install -y git python3 make g++ && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
Expand All @@ -22,11 +22,19 @@ COPY tsconfig.json ./
# Copy the rest of the application code
COPY ./src ./src
COPY ./characters ./characters
COPY ./.env ./

# Install dependencies and build the project
RUN pnpm i
RUN pnpm install --frozen-lockfile
RUN pnpm build

# Create dist directory and set permissions
RUN mkdir -p /app/dist && \
chown -R node:node /app && \
chmod -R 755 /app

# Switch to node user
USER node

# Create a new stage for the final image
FROM node:23.3.0-slim

Expand All @@ -44,12 +52,10 @@ COPY --from=builder /app/package.json /app/
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/src /app/src
COPY --from=builder /app/characters /app/characters
COPY --from=builder /app/.env /app/
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/tsconfig.json /app/
COPY --from=builder /app/pnpm-lock.yaml /app/

EXPOSE 3000
# Set the command to run the application
CMD ["pnpm", "start", "--non-interactive"]
# CMD ["node", "dist/index.js"]
CMD ["pnpm", "start", "--non-interactive"]
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,45 @@ TWITTER_EMAIL="your@email.com"
pnpm i && pnpm start
```
Note: this requires node to be at least version 22 when you install packages and run the agent.

## Run with Docker

### Build and run Docker Compose (For x86_64 architecture)

#### Edit the docker-compose.yaml file with your environment variables

```yaml
services:
eliza:
environment:
- OPENROUTER_API_KEY=blahdeeblahblahblah
```
#### Run the image
```bash
docker compose up
```

### Build the image with Mac M-Series or aarch64

Make sure docker is running.

```bash
docker buildx build --platform linux/amd64 -t eliza-starter:v1 .
```

#### Edit the docker-compose-image.yaml file with your environment variables

```yaml
services:
eliza:
environment:
- OPENROUTER_API_KEY=blahdeeblahblahblah
```
#### Run the image
```bash
docker compose -f docker-compose-image.yaml up
```
30 changes: 30 additions & 0 deletions docker-compose-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
services:
eliza:
command: ["pnpm", "start", "--character=./characters/eliza.character.json"]
image: eliza-starter:v1
stdin_open: true
tty: true
volumes:
- ./data:/app/data
environment:
- DISCORD_APPLICATION_ID=
- DISCORD_API_TOKEN=
- REDPILL_API_KEY=
- REDPILL_MODEL=
- ELEVENLABS_XI_API_KEY=
- ELEVENLABS_MODEL_ID=eleven_multilingual_v2
- ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
- ELEVENLABS_VOICE_STABILITY=0.5
- ELEVENLABS_VOICE_SIMILARITY_BOOST=0.9
- ELEVENLABS_VOICE_STYLE=0.66
- ELEVENLABS_VOICE_USE_SPEAKER_BOOST=false
- ELEVENLABS_OPTIMIZE_STREAMING_LATENCY=4
- ELEVENLABS_OUTPUT_FORMAT=pcm_16000
- SOL_ADDRESS=So11111111111111111111111111111111111111112
- SLIPPAGE=1
- SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
- HELIUS_API_KEY=
- SERVER_PORT=3000
ports:
- "3000:3000"
restart: always
29 changes: 29 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
services:
eliza:
command: ["pnpm", "start", "--character=./characters/eliza.character.json"]
build:
context: .
dockerfile: Dockerfile
stdin_open: true
tty: true
volumes:
- ./data:/app/data
environment:
- OPENROUTER_API_KEY=
- ELEVENLABS_XI_API_KEY=
- ELEVENLABS_MODEL_ID=eleven_multilingual_v2
- ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
- ELEVENLABS_VOICE_STABILITY=0.5
- ELEVENLABS_VOICE_SIMILARITY_BOOST=0.9
- ELEVENLABS_VOICE_STYLE=0.66
- ELEVENLABS_VOICE_USE_SPEAKER_BOOST=false
- ELEVENLABS_OPTIMIZE_STREAMING_LATENCY=4
- ELEVENLABS_OUTPUT_FORMAT=pcm_16000
- SOL_ADDRESS=So11111111111111111111111111111111111111112
- SLIPPAGE=1
- SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
- HELIUS_API_KEY=
- SERVER_PORT=3000
ports:
- "3000:3000"
restart: always

0 comments on commit 61e4c41

Please sign in to comment.