From 0a481f5c856c1aad45cc6f5c238d26d1046bbcbe Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Tue, 27 Jul 2021 18:53:55 +0300 Subject: [PATCH] feat: dockerize for portability Installing on MacOS is not possible due to dependencies on specific features like https://stackoverflow.com/a/43505799 https://stackoverflow.com/a/53075997 --- Dockerfile | 31 +++++++++++++++++++++++++++++++ README.md | 10 ++++++++++ 2 files changed, 41 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..55592c8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# Build the prover +FROM node as builder + +WORKDIR /rapidsnark + +# install deps +RUN apt update && apt install build-essential libgmp-dev libsodium-dev nasm + +COPY ./*.json tasksfile.js tools . +COPY ./.git ./.git +COPY ./depends ./depends +COPY ./src ./src + +# install the node deps +RUN npm install && git submodule init && git submodule update + +# build the fields +RUN npx task createFieldSources + +# build the provder +RUN npx task buildProver + +FROM ubuntu + +WORKDIR /rapidsnark + +RUN apt update -y && apt install -y build-essential libgmp-dev libsodium-dev nasm + +COPY --from=builder /rapidsnark/build/prover /usr/local/bin/rapidsnark + +CMD ["rapidsnark"] diff --git a/README.md b/README.md index 8f0bf1e..50a5abe 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,11 @@ npx task createFieldSources npx task buildProver ```` +## compile with docker +```sh +docker build . --tag=rapidsnark +``` + ## Building proof You have a full prover compiled in the build directory. @@ -40,6 +45,11 @@ by this one ./build/prove ```` +or this one if using Docker +````sh +docker run rapidsnark +```` + ## Benchmark This prover uses intel assembly with ADX extensions and parallelizes as much as it can the proof generation.