diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b9c59772a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.idea +cmake +cmake-build-debug +data diff --git a/.env b/.env new file mode 100644 index 000000000..e8923e952 --- /dev/null +++ b/.env @@ -0,0 +1,6 @@ +RPC_USER=dockeruser +RPC_PASSWORD=dockerpass +RPC_WORKQUEUE=32 +RPC_THREADS=16 +RPC_ALLOW_IP=0.0.0.0/0 +TX_INDEX=1 diff --git a/.gitignore b/.gitignore index 446b24e59..36bda8d18 100644 --- a/.gitignore +++ b/.gitignore @@ -147,3 +147,8 @@ nbproject/ #Local Development Environment - MinGW64 mingw64/ + +.idea +cmake-build-debug +cmake +data diff --git a/Dockerfile b/Dockerfile index 2809a497a..2d1d77e4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,10 @@ LABEL version="1.0.0" LABEL description="Docker image for radiantd node" ARG DEBIAN_FRONTEND=nointeractive +RUN sed -i 's|http://archive.ubuntu.com/ubuntu|http://mirrors.edge.kernel.org/ubuntu|g' /etc/apt/sources.list RUN apt update RUN apt-get install -y curl + RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - RUN apt-get install -y nodejs @@ -29,7 +31,6 @@ ENV PACKAGES="\ libjansson-dev \ libevent-dev \ uthash-dev \ - nodejs \ vim \ libboost-chrono-dev \ libboost-filesystem-dev \ @@ -38,7 +39,7 @@ ENV PACKAGES="\ libevent-dev \ libminiupnpc-dev \ libssl-dev \ - libzmq3-dev \ + libzmq3-dev \ help2man \ ninja-build \ python3 \ @@ -49,10 +50,8 @@ ENV PACKAGES="\ opencl-headers \ ocl-icd-opencl-dev\ " -# Note can remove the opencl and ocl packages above when not building on a system for GPU/mining -# Included only for reference purposes if this container would be used for mining as well. -RUN apt update && apt install --no-install-recommends -y $PACKAGES && \ +RUN apt update && apt install --no-install-recommends -y $PACKAGES && \ rm -rf /var/lib/apt/lists/* && \ apt clean @@ -65,20 +64,34 @@ RUN apt update && apt install --no-install-recommends -y $PACKAGES && \ # RUN ./bootstrap # RUN make # RUN make install - + # Install radiant-node WORKDIR /root -RUN git clone --depth 1 --branch v1.3.0 https://github.com/radiantblockchain/radiant-node.git +#RUN git clone --depth 1 --branch v1.3.0 https://github.com/radiantblockchain/radiant-node.git +COPY . /root/radiant-node RUN mkdir /root/radiant-node/build WORKDIR /root/radiant-node/build RUN cmake -GNinja .. -DBUILD_RADIANT_QT=OFF + +RUN apt-get update +RUN apt-get install -y dos2unix + +# Ensure scripts have correct line endings and permissions +RUN find /root/radiant-node/build /root/radiant-node/cmake/utils /root/radiant-node/share -type f \( -name "*.sh" -o -name "*.py" \) -exec dos2unix {} \; -exec chmod +x {} \; + RUN ninja RUN ninja install WORKDIR /root/radiant-node/build/src +# Runtime environment variables from the .env file +ENV RPC_USER=${RPC_USER} +ENV RPC_PASSWORD=${RPC_PASSWORD} +ENV RPC_WORKQUEUE=${RPC_WORKQUEUE} +ENV RPC_THREADS=${RPC_THREADS} +ENV RPC_ALLOW_IP=${RPC_ALLOW_IP} +ENV TX_INDEX=${TX_INDEX} + EXPOSE 7332 7333 - -ENTRYPOINT ["radiantd", "-rpcworkqueue=32", "-rpcthreads=16", "-rest", "-server", "-rpcallowip=0.0.0.0/0", "-txindex=1", "-rpcuser=dockeruser", "-rpcpassword=dockerpass"] - - + +ENTRYPOINT ["radiantd", "-rpcworkqueue=${RPC_WORKQUEUE}", "-rpcthreads=${RPC_THREADS}", "-rest", "-server", "-rpcallowip=${RPC_ALLOW_IP}", "-txindex=${TX_INDEX}", "-rpcuser=${RPC_USER}", "-rpcpassword=${RPC_PASSWORD}"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..468ccdb9e --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,16 @@ +version: "3" +services: + radiant_node: + build: . + container_name: radiant_node_container + ports: + - "7332:7332" + - "7333:7333" + - "17443:17443" + volumes: + - ./data:/root/.radiant # Mount local Windows folder ./data to the container's /root/.radiant + env_file: # Load environment variables from the .env file + - .env + network_mode: "host" + stop_grace_period: 60s + entrypoint: ["radiantd", "-regtest", "-rpcworkqueue=${RPC_WORKQUEUE}", "-rpcthreads=${RPC_THREADS}", "-rpcbind=0.0.0.0", "-rest", "-server", "-rpcallowip=${RPC_ALLOW_IP}", "-txindex=${TX_INDEX}", "-rpcuser=${RPC_USER}", "-rpcpassword=${RPC_PASSWORD}", "-maxconnections=200"]