lushdog@outlook.com 9 månader sedan
incheckning
e6265f6b40
4 ändrade filer med 76 tillägg och 0 borttagningar
  1. 26 0
      Dockerfile
  2. 1 0
      README.md
  3. 44 0
      docker-compose.yml
  4. 5 0
      entrypoint.sh

+ 26 - 0
Dockerfile

@@ -0,0 +1,26 @@
+FROM rust:bullseye AS builder
+
+RUN apt update && apt install -y wget clang cmake build-essential libclang-dev git
+
+WORKDIR /app
+
+RUN git clone https://github.com/zorp-corp/nockchain.git && \
+    cd nockchain && \
+    make install-choo && \
+    make build-hoon-all && \
+    make build
+
+FROM debian:bullseye-slim
+
+RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
+
+COPY --from=builder /app/nockchain/target/release/nockchain /app/bin
+
+WORKDIR /app/data
+
+COPY entrypoint.sh /app/entrypoint.sh
+
+RUN chmod +x /app/entrypoint.sh
+
+# 设置默认命令
+ENTRYPOINT ["./entrypoint.sh"]

+ 1 - 0
README.md

@@ -0,0 +1 @@
+# nockchain

+ 44 - 0
docker-compose.yml

@@ -0,0 +1,44 @@
+services:
+  nockchain-leader:
+    image: ghcr.io/lushdog/nockchain:latest
+    privileged: true
+    volumes:
+      - ./nockchain-leader:/app/data
+    environment:
+      - MINING_PUBKEY=${MINING_PUBKEY:?please make sure to set your MINING_PUBKEY environment variable in the .env file}
+    command:
+      - "--fakenet"
+      - "--genesis-leader"
+      - "--npc-socket"
+      - "nockchain.sock"
+      - "--mining-pubkey"
+      - "${MINING_PUBKEY}"
+      - "--bind"
+      - "/ip4/0.0.0.0/udp/3005/quic-v1"
+      - "--peer"
+      - "/ip4/127.0.0.1/udp/3006/quic-v1"
+      - "--new-peer-id"
+      - "--no-default-peers"
+    restart: unless-stopped
+
+  nockchain-follower:
+    image: ghcr.io/lushdog/nockchain:latest
+    privileged: true
+    volumes:
+      - ./nockchain-follower:/app/data
+    environment:
+      - MINING_PUBKEY=${MINING_PUBKEY:?please make sure to set your MINING_PUBKEY environment variable in the .env file}
+    command:
+      - "--fakenet"
+      - "--genesis-watcher"
+      - "--npc-socket"
+      - "nockchain.sock"
+      - "--mining-pubkey"
+      - "${MINING_PUBKEY}"
+      - "--bind"
+      - "/ip4/0.0.0.0/udp/3005/quic-v1"
+      - "--peer"
+      - "/ip4/127.0.0.1/udp/3006/quic-v1"
+      - "--new-peer-id"
+      - "--no-default-peers"
+    restart: unless-stopped

+ 5 - 0
entrypoint.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+echo "starting nockchain with $@"
+
+exec ../bin/nockchain "$@"