From 510e0dfefcf559a795b768f638077bba82f2d284 Mon Sep 17 00:00:00 2001 From: hrezaei Date: Sat, 28 Jan 2023 11:50:20 +0000 Subject: [PATCH] ADD: docker files to run project in a container Signed-off-by: hrezaei --- README.md | 17 +++++++++++++++++ docker/Dockerfile | 10 ++++++++++ docker/docker-compose.yaml | 17 +++++++++++++++++ docker/docker-entrypoint.sh | 5 +++++ 4 files changed, 49 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yaml create mode 100755 docker/docker-entrypoint.sh diff --git a/README.md b/README.md index 1aae7ff..8f165f5 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ properties of both neural nets (learning) and symbolic logic (knowledge and reas knowledge. ## Quickstart +You can install the LNN locally on your machine or inside a container. +### Install on Local Machine To install the LNN: 1. Make sure that the python version you use in line with our [setup](https://github.com/IBM/LNN/blob/master/setup.py) file, using a fresh environment is always a good idea: @@ -32,7 +34,22 @@ To install the LNN: ```commandline pip install git+https://github.com/IBM/LNN ``` +### Run in Container +Download or clone the repository using the command below: +```commandline +git clone https://github.com/IBM/LNN.git +``` + +and then run +```commandline +cd docker && docker-compose up +``` +Then open the address below in your browser: +``` +http://localhost:8888/ +``` +This should open the Jupyter Notebook UI with all environment ready to work with LNN. ## Contribution Contributions to the LNN codebase are welcome! diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..38cbe3c --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.9.10-slim-buster + +WORKDIR /home/LNN + +RUN apt-get update && apt-get install --assume-yes gcc wget python3-dev git graphviz graphviz-dev libgraphviz-dev pkg-config libgmp-dev +RUN /usr/local/bin/python -m pip install --upgrade pip + +EXPOSE 8888 + +CMD ["./docker/docker-entrypoint.sh"] \ No newline at end of file diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml new file mode 100644 index 0000000..2738662 --- /dev/null +++ b/docker/docker-compose.yaml @@ -0,0 +1,17 @@ +version: '3.3' + +services: + ibm_lnn: + container_name: ibm_lnn + build: + context: ../ + dockerfile: docker/Dockerfile + ports: + - "8888:8888" + volumes: + - ../:/home/LNN + + + + + \ No newline at end of file diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh new file mode 100755 index 0000000..dbdb153 --- /dev/null +++ b/docker/docker-entrypoint.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +pip install . + +jupyter notebook --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.token='' --NotebookApp.password='' \ No newline at end of file