From 46400ff28369d7bbab39bc071a9b840d1006a0c7 Mon Sep 17 00:00:00 2001 From: onekill0503 Date: Tue, 10 Dec 2024 01:55:20 +0700 Subject: [PATCH 1/2] feat: add docker compose integration --- Dockerfile | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 6 ++++++ entrypoint.sh | 11 +++++++++++ 3 files changed, 47 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..44cd806 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM rust:bullseye AS builder + +RUN apt update && \ + apt install -y build-essential pkg-config libssl-dev protobuf-compiler && \ + mkdir /root/.nexus && \ + cd /root/.nexus && \ + git clone https://github.com/nexus-xyz/network-api && \ + cd network-api && \ + git -c advice.detachedHead=false checkout $(git rev-list --tags --max-count=1) + +WORKDIR /root/.nexus/network-api/clients/cli + +RUN cargo build --release --bin prover + +FROM debian:bullseye-slim + +RUN apt update && \ + apt install -y ca-certificates && \ + mkdir /root/.nexus + +COPY --from=builder /root/.nexus/network-api/clients/cli/src /root/.nexus/src +COPY --from=builder /root/.nexus/network-api/clients/cli/target/release/prover /root/.nexus/prover + +WORKDIR /root/.nexus + +COPY entrypoint.sh . + +RUN chmod +x entrypoint.sh + +CMD ["./entrypoint.sh", "./prover", "beta.orchestrator.nexus.xyz"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e969a63 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +version: '3' +services: + nexus: + build: . + environment: + - PROVER_ID=PROVER_ID_HERE \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..bd250d7 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ -z "${PROVER_ID}" ]; then + echo "Error: PROVER_ID environment variable is not set or is empty" + exit 1 +fi + +NEXUS_HOME=$HOME/.nexus +echo "$PROVER_ID" > $NEXUS_HOME/prover-id + +exec "$@" \ No newline at end of file From 0fe594a705b7224249004888f3138f29d6e6b55d Mon Sep 17 00:00:00 2001 From: onekill0503 Date: Tue, 10 Dec 2024 02:08:06 +0700 Subject: [PATCH 2/2] feat: add docker installation guide --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 100ece0..1999b29 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,22 @@ curl https://cli.nexus.xyz/ | sh If you don't have Rust installed, you will be prompted to install it. +## Quick Start (Docker) + +Make sure docker and docker compose have been installed on you machine. check documentation here : +- [Install Docker](https://docs.docker.com/engine/install/) +- [Install Docker Compose](https://docs.docker.com/compose/install/) + +Update your `PROVER_ID` at `docker-compose.yml`. then run command below to start proving. +```bash +docker compose up -d +``` + +For see the logs you can run this commands +```bash +docker compose logs -f +``` + ## Prerequisites ### Linux