diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..fbe0519f67 --- /dev/null +++ b/docker/Dockerfile @@ -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 " \ + source="https://github.com/dojoengine/dojo" \ + documentation="https://book.dojoengine.org/" diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000000..a72b64a897 --- /dev/null +++ b/docker/docker-compose.yml @@ -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" + diff --git a/docker/image_build.sh b/docker/image_build.sh new file mode 100644 index 0000000000..7259c64dba --- /dev/null +++ b/docker/image_build.sh @@ -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} \ No newline at end of file diff --git a/docker/torii.toml b/docker/torii.toml new file mode 100644 index 0000000000..c2f60023c1 --- /dev/null +++ b/docker/torii.toml @@ -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 \ No newline at end of file