diff --git a/CHANGES b/CHANGES index d2ef372d2..eeb06853f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +Pre-release: + - Docker update, see the ["docker/"] directory + Version 4.3.3 - 8 August 2023 - Minor bugfix in pyqpp setup.py that prevented pip install from remote - Bug fix in qpp::QEngine::execute() that prevented setting the initial diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index fa6f834a6..000000000 --- a/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM ubuntu:latest -ENV TZ="America/Toronto" -RUN apt-get update && \ - apt-get -y update && \ - apt-get install -yq tzdata && \ - ln -fs /usr/share/zoneinfo/America/Toronto /etc/localtime && \ - dpkg-reconfigure -f noninteractive tzdata - -RUN apt-get install -y \ - build-essential \ - python3.10 \ - python3-pip \ - python3-dev \ - libeigen3-dev \ - cmake \ - git - -RUN pip3 -q install pip --upgrade - -RUN mkdir -p softwareq/qpp/notebooks -WORKDIR softwareq/qpp -COPY . . - -RUN pip3 install jupyter matplotlib numpy -RUN pip3 install git+https://github.com/softwareqinc/qpp - -WORKDIR /src/notebooks - -CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"] diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..18be088e1 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu:latest +ENV TZ="America/Toronto" +RUN apt-get update && \ + apt-get -y update && \ + apt-get install -yq tzdata && \ + ln -fs /usr/share/zoneinfo/America/Toronto /etc/localtime && \ + dpkg-reconfigure -f noninteractive tzdata + +RUN apt-get install -y build-essential python3.10 python3-pip python3-dev \ + libeigen3-dev cmake sudo git vim + +# Install pyqpp +RUN pip3 -q install pip --upgrade +RUN pip3 install jupyter matplotlib numpy +RUN pip3 install git+https://github.com/softwareqinc/qpp + +# Enable a normal user with sudo access +RUN useradd -m -c "softwareQ" sq +RUN echo '%sq ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +USER sq + +# Clone and install Quantum++ +WORKDIR /home/sq +RUN git clone --depth 1 --branch main https://github.com/softwareqinc/qpp +WORKDIR /home/sq/qpp +RUN cmake -B build -DWITH_UNIT_TESTS=ON -DWITH_EXAMPLES=ON && \ + sudo cmake --build build --target install +USER sq +WORKDIR /home/sq + +# Create a notebook directory for Jupyter +RUN mkdir notebooks diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..a4a622cd7 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,23 @@ +## Docker + +A self-explanatory minimalistic Docker file is provided +in [`Dockerfile`](https://github.com/softwareqinc/qpp/tree/main/docker/Dockerfile). + +Build the image by executing + +```shell +docker build -t softwareq-qpp . +``` + +Run the Jupyter server in a container by executing + +```shell +docker run -p8888:8888 -it --workdir=/home/sq/notebooks softwareq-qpp sh -c "jupyter notebook --port=8888 --no-browser --ip=0.0.0.0" +``` + +In case you want to use the Docker container as a development environment, mount +your directory (in this case the current directory) in a Docker container with + +```shell +docker run --rm -it --workdir=/home/sq/hostdir -v ${PWD}:/home/sq/hostdir softwareq-qpp /bin/bash +```