From d3a203ded5886504d9726e568f3bd92bdce93757 Mon Sep 17 00:00:00 2001 From: Viraat Das Date: Tue, 29 Oct 2024 18:49:14 -0700 Subject: [PATCH] added a way to build with Docker --- Dockerfile | 26 ++++++++++++++++++++++++++ README.md | 16 ++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dd23c28 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Start with a lightweight Python image +FROM python:3.10-slim + +# Install necessary build tools and dependencies for PySNARK +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + swig \ + cmake \ + g++ \ + git \ + npm \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install PySNARK from GitHub +RUN pip install git+https://github.com/meilof/pysnark + +# Set up a working directory in the container +WORKDIR /app + +# Copy your local files (replace with your paths) +COPY . /app + +# Default command for the container +CMD ["python3"] + diff --git a/README.md b/README.md index ca1f2db..49812a8 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,22 @@ PySNARK is experimental and **not fit for production environment**. [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/meilof/pysnark/nobackend?filepath=notebooks%2Ftest.ipynb) +## Running with Docker (skip if using pip installation) + +Dockerfile is already provided. + +**Building:** +``` +docker build -t pysnark-env . +``` + +**Running:** +``` +docker run -it --rm -v "$(pwd)/examples:/app" pysnark-env python3 /app/cube.py 3 +``` + + + ## Installation ```