Skip to content

Commit

Permalink
[ISSUES#2902] docker && docker-compose.
Browse files Browse the repository at this point in the history
  • Loading branch information
847850277 committed Jan 14, 2025
1 parent fde72d7 commit d044ea3
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM debian:bookworm-slim as builder

RUN apt-get update && apt install -y git libtool automake autoconf make tini curl

## install dojoengine
RUN curl -L https://install.dojoengine.org | bash

SHELL ["/bin/bash", "-c"]

RUN source /root/.bashrc && dojoup

FROM debian:bookworm-slim as base

COPY --from=builder /usr/bin/tini /tini
COPY --from=builder /root/.dojo/bin/katana /usr/local/bin/katana
COPY --from=builder /root/.dojo/bin/sozo /usr/local/bin/sozo
COPY --from=builder /root/.dojo/bin/torii /usr/local/bin/torii

LABEL description="Dojo is a provable game engine and toolchain for building onchain games and autonomous worlds with Cairo" \
authors="tarrence <[email protected]>" \
source="https://github.com/dojoengine/dojo" \
documentation="https://book.dojoengine.org/"
20 changes: 20 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3.8'

services:
katana:
image: dojoengine:latest
command: katana --dev --dev.no-fee --http.cors_origins "*" --http.addr 0.0.0.0
ports:
- "5050:5050"
torii:
image: dojoengine:latest
command: torii --config /etc/torii/torii.toml
volumes:
- ./torii.toml:/etc/torii/torii.toml
ports:
- "8080:8080"
- "9090:9090"
- "9091:9091"
- "9092:9092"
- "9200:9200"

15 changes: 15 additions & 0 deletions docker/image_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Define the image name and tag
IMAGE_NAME="dojoengine"
IMAGE_TAG="latest"
DOCKERHUB_USERNAME="your_dockerhub_username"

# Build the Docker image
docker build -t ${IMAGE_NAME}:${IMAGE_TAG} .

# Log in to Docker Hub
docker login --username ${DOCKERHUB_USERNAME}

# Push the Docker image to Docker Hub
docker push ${IMAGE_NAME}:${IMAGE_TAG}
60 changes: 60 additions & 0 deletions docker/torii.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# The World address to index.
world_address = "0x0525177c8afe8680d7ad1da30ca183e482cfcd6404c1e09d83fd3fa2994fd4b8"

# Default RPC URL configuration
rpc = "http://host.docker.internal:5050"

# Database configuration
# Optional: If not specified, uses in-memory database
db_dir = "/tmp/torii"

# External URL for GraphQL Playground
# Optional: Used in hosted environments
# external_url = ""

# Whether to open World Explorer in browser
# Optional: Defaults to false
# explorer = false



# Server Options
[server]
http_addr = "0.0.0.0"
http_port = 8080
http_cors_origins = ["*"]

# Relay Options
[relay]
port = 9090 # TCP & UDP Quic transport
webrtc_port = 9091 # WebRTC transport
websocket_port = 9092 # WebSocket transport
# relay.local_key_path = "" # Optional: Path to identity key file, generated if none.
# relay.cert_path = "" # Optional: Path to certificate file for WebRTC

# Indexing Options
[indexing]
events_chunk_size = 1024 # Size of events page to fetch
blocks_chunk_size = 10240 # Blocks to process before DB commit
index_pending = true # Enable indexing pending blocks
polling_interval = 500 # Polling interval in milliseconds
max_concurrent_tasks = 100 # Maximum concurrent indexing tasks
index_transactions = false # Whether to index world transactions
contracts = [ # ERC contracts to index
"erc20:0x1234",
"erc721:0x5678"
]

# Events Options
[events]
raw = true # Whether to index raw events
historical = [ # Historical event message tags
"ns-E",
"ns-EH"
]

# Metrics Options
[metrics]
metrics = true # Enable metrics server
addr = "0.0.0.0" # Metrics server address
port = 9200 # Metrics server port

0 comments on commit d044ea3

Please sign in to comment.