소스 검색

Adds a docker file, updates instructions, and increments the version (#109)

* added the docker file

* Updated the readme file and version number

* Update README.md

* updated the docker file

* Update README.md

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>
yspolyakov 9 달 전
부모
커밋
971c0d342b
4개의 변경된 파일114개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      CMakeLists.txt
  2. 7 2
      README.md
  3. 54 0
      docker/Dockerfile
  4. 52 0
      docker/README.md

+ 1 - 1
CMakeLists.txt

@@ -4,7 +4,7 @@ project (OpenFHE-Python)
 
 set(OPENFHE_PYTHON_VERSION_MAJOR 0)
 set(OPENFHE_PYTHON_VERSION_MINOR 8)
-set(OPENFHE_PYTHON_VERSION_PATCH 4)
+set(OPENFHE_PYTHON_VERSION_PATCH 5)
 set(OPENFHE_PYTHON_VERSION ${OPENFHE_PYTHON_VERSION_MAJOR}.${OPENFHE_PYTHON_VERSION_MINOR}.${OPENFHE_PYTHON_VERSION_PATCH})
 
 set(CMAKE_CXX_STANDARD 17)

+ 7 - 2
README.md

@@ -2,7 +2,8 @@
 
 ## Table of Contents
 
-- [Building](#building)
+- [Running from Docker](#running-from-docker)
+- [Building from Source](#building-from-source)
   - [Prerequisites](#requirements)
   - [Linux Install](#linux)
     - [Installing directly on your system](#system-level-installation)
@@ -11,7 +12,11 @@
 - [OpenFHE Python Wrapper Documentation](#openfhe-python-wrapper-documentation)
 - [Contributing Guide](#contributing-guide)
 
-## Building
+## Running from Docker
+
+Please see [Instructions for the Docker setup](docker/README.md)
+
+## Building from Source
 
 ### Requirements
 

+ 54 - 0
docker/Dockerfile

@@ -0,0 +1,54 @@
+# Use the official Ubuntu base image
+FROM ubuntu:22.04
+
+# Set environment variables to non-interactive (this prevents some prompts)
+ENV DEBIAN_FRONTEND=noninteractive
+
+# Install necessary dependencies for OpenFHE and JupyterLab
+RUN apt-get update && apt-get install -y \
+    git \
+    cmake \
+    build-essential \
+    python3 \
+    python3-dev \
+    python3-pip \
+    python3-venv \
+    sudo \
+    && apt-get clean && rm -rf /var/lib/apt/lists/*
+
+# Install PyBind11
+RUN pip3 install "pybind11[global]"
+	
+# Install JupyterLab
+RUN python3 -m pip install --no-cache-dir jupyterlab
+
+# Clone and build OpenFHE-development
+RUN git clone https://github.com/openfheorg/openfhe-development.git \
+    && cd openfhe-development \
+    && mkdir build \
+    && cd build \
+    && cmake -DBUILD_UNITTESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_BENCHMARKS=OFF .. \
+    && make -j$(nproc) \
+    && make install
+
+# Assume that OpenFHE installs libraries into /usr/local/lib
+# Update LD_LIBRARY_PATH to include this directory
+ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
+
+# Clone and build OpenFHE-Python
+RUN git clone https://github.com/openfheorg/openfhe-python.git \
+    && cd openfhe-python \
+    && mkdir build \
+    && cd build \
+    && cmake .. \
+    && make -j$(nproc) \
+    && make install
+
+# Expose the port JupyterLab will listen on
+EXPOSE 8888
+
+# Set the working directory
+WORKDIR /workspace
+
+# Start JupyterLab without token authentication
+CMD ["jupyter-lab", "--ip=0.0.0.0", "--no-browser", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.allow_origin='*'", "--NotebookApp.password=''", "--NotebookApp.password_required=False"]

+ 52 - 0
docker/README.md

@@ -0,0 +1,52 @@
+# Readme
+
+### Command to build the docker image:
+
+```docker
+docker build -t openfhe-docker .
+```
+Make sure you run this command from the same folder where the Dockerfile is located (in the "docker" folder of the openfhe-python repository).
+
+### Command to check if the image is built:
+
+```docker
+docker images
+```
+
+You should see a "openfhe-docker" in the list
+
+### Command to create the container from the image:
+
+```docker
+docker run -d -p 8888:8888 openfhe-docker
+```
+
+### Command to check if the container is running:
+
+```docker
+docker ps
+```
+
+You should see openfhe-docker running
+
+### This openfhe-docker has jupyterlab installed in it which has access to openfhe installation and is accessible via localhost. To run the jupyterlab use:
+
+```docker
+[http://localhost:8888](http://localhost:8888/)
+```
+
+All the code can be executed through this jupyterlab now
+
+## Alternate way to execute the code in this docker:
+
+### Go inside the docker, use:
+
+```docker
+docker exec -it <container-name> /bin/bash
+```
+
+replace the <container-name> with the name that you see when you use the command "docker run -d -p 8888:8888 openfhe-docker"
+
+This takes you to a terminal interface inside the container which has all the dependencies installed.
+
+You can now clone a github repo that depends on OpenFHE and run the code.