Skip to content

Commit 971c0d3

Browse files
yspolyakovYuriy Polyakov
andauthored
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 <[email protected]>
1 parent 9fb9160 commit 971c0d3

File tree

4 files changed

+114
-3
lines changed

4 files changed

+114
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project (OpenFHE-Python)
44

55
set(OPENFHE_PYTHON_VERSION_MAJOR 0)
66
set(OPENFHE_PYTHON_VERSION_MINOR 8)
7-
set(OPENFHE_PYTHON_VERSION_PATCH 4)
7+
set(OPENFHE_PYTHON_VERSION_PATCH 5)
88
set(OPENFHE_PYTHON_VERSION ${OPENFHE_PYTHON_VERSION_MAJOR}.${OPENFHE_PYTHON_VERSION_MINOR}.${OPENFHE_PYTHON_VERSION_PATCH})
99

1010
set(CMAKE_CXX_STANDARD 17)

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Table of Contents
44

5-
- [Building](#building)
5+
- [Running from Docker](#running-from-docker)
6+
- [Building from Source](#building-from-source)
67
- [Prerequisites](#requirements)
78
- [Linux Install](#linux)
89
- [Installing directly on your system](#system-level-installation)
@@ -11,7 +12,11 @@
1112
- [OpenFHE Python Wrapper Documentation](#openfhe-python-wrapper-documentation)
1213
- [Contributing Guide](#contributing-guide)
1314

14-
## Building
15+
## Running from Docker
16+
17+
Please see [Instructions for the Docker setup](docker/README.md)
18+
19+
## Building from Source
1520

1621
### Requirements
1722

docker/Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Use the official Ubuntu base image
2+
FROM ubuntu:22.04
3+
4+
# Set environment variables to non-interactive (this prevents some prompts)
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
7+
# Install necessary dependencies for OpenFHE and JupyterLab
8+
RUN apt-get update && apt-get install -y \
9+
git \
10+
cmake \
11+
build-essential \
12+
python3 \
13+
python3-dev \
14+
python3-pip \
15+
python3-venv \
16+
sudo \
17+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
18+
19+
# Install PyBind11
20+
RUN pip3 install "pybind11[global]"
21+
22+
# Install JupyterLab
23+
RUN python3 -m pip install --no-cache-dir jupyterlab
24+
25+
# Clone and build OpenFHE-development
26+
RUN git clone https://github.com/openfheorg/openfhe-development.git \
27+
&& cd openfhe-development \
28+
&& mkdir build \
29+
&& cd build \
30+
&& cmake -DBUILD_UNITTESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_BENCHMARKS=OFF .. \
31+
&& make -j$(nproc) \
32+
&& make install
33+
34+
# Assume that OpenFHE installs libraries into /usr/local/lib
35+
# Update LD_LIBRARY_PATH to include this directory
36+
ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
37+
38+
# Clone and build OpenFHE-Python
39+
RUN git clone https://github.com/openfheorg/openfhe-python.git \
40+
&& cd openfhe-python \
41+
&& mkdir build \
42+
&& cd build \
43+
&& cmake .. \
44+
&& make -j$(nproc) \
45+
&& make install
46+
47+
# Expose the port JupyterLab will listen on
48+
EXPOSE 8888
49+
50+
# Set the working directory
51+
WORKDIR /workspace
52+
53+
# Start JupyterLab without token authentication
54+
CMD ["jupyter-lab", "--ip=0.0.0.0", "--no-browser", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.allow_origin='*'", "--NotebookApp.password=''", "--NotebookApp.password_required=False"]

docker/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Readme
2+
3+
### Command to build the docker image:
4+
5+
```docker
6+
docker build -t openfhe-docker .
7+
```
8+
Make sure you run this command from the same folder where the Dockerfile is located (in the "docker" folder of the openfhe-python repository).
9+
10+
### Command to check if the image is built:
11+
12+
```docker
13+
docker images
14+
```
15+
16+
You should see a "openfhe-docker" in the list
17+
18+
### Command to create the container from the image:
19+
20+
```docker
21+
docker run -d -p 8888:8888 openfhe-docker
22+
```
23+
24+
### Command to check if the container is running:
25+
26+
```docker
27+
docker ps
28+
```
29+
30+
You should see openfhe-docker running
31+
32+
### This openfhe-docker has jupyterlab installed in it which has access to openfhe installation and is accessible via localhost. To run the jupyterlab use:
33+
34+
```docker
35+
[http://localhost:8888](http://localhost:8888/)
36+
```
37+
38+
All the code can be executed through this jupyterlab now
39+
40+
## Alternate way to execute the code in this docker:
41+
42+
### Go inside the docker, use:
43+
44+
```docker
45+
docker exec -it <container-name> /bin/bash
46+
```
47+
48+
replace the <container-name> with the name that you see when you use the command "docker run -d -p 8888:8888 openfhe-docker"
49+
50+
This takes you to a terminal interface inside the container which has all the dependencies installed.
51+
52+
You can now clone a github repo that depends on OpenFHE and run the code.

0 commit comments

Comments
 (0)