From 6c18e938b74bd85d60fa3e0773d23d3eb910f149 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Fri, 10 Feb 2023 09:01:26 +0100 Subject: [PATCH] Add initial Docker setup. (#56) --- Dockerfile | 30 ++++++++++++++++++++++++++++++ README.md | 17 +++++++++++++++++ pyproject.toml | 4 ++-- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..1cdcc6af --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM ubuntu:22.10 + +# build-essential is needed for building the C++ code in the PPAFM package + +RUN apt-get update --yes && \ + apt-get install --yes --no-install-recommends \ + build-essential \ + python3 \ + python3-pip \ + python-is-python3 && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN useradd -ms /bin/bash ppafm-user + +RUN mkdir /exec && chown ppafm-user:ppafm-user /exec + +USER ppafm-user + +WORKDIR /home/ppafm-user + +RUN pip install --upgrade --user pip && pip cache purge + +COPY --chown=ppafm-user:ppafm-user ./ ppafm + +RUN pip install -e ppafm/ && pip cache purge + + +ENV PATH="${PATH}:/home/ppafm-user/ppafm/" + +WORKDIR /exec diff --git a/README.md b/README.md index 08f9f5bd..dc84413f 100644 --- a/README.md +++ b/README.md @@ -112,5 +112,22 @@ Hover the mouse cursor over any parameter for a tooltip explaining the meaning o * [Prokop Hapala, Georgy Kichin, Christian Wagner, F. Stefan Tautz, Ruslan Temirov, and Pavel Jelínek, Mechanism of high-resolution STM/AFM imaging with functionalized tips, Phys. Rev. B 90, 085421 – Published 19 August 2014](http://journals.aps.org/prb/abstract/10.1103/PhysRevB.90.085421) * [Prokop Hapala, Ruslan Temirov, F. Stefan Tautz, and Pavel Jelínek, Origin of High-Resolution IETS-STM Images of Organic Molecules with Functionalized Tips, Phys. Rev. Lett. 113, 226101 – Published 25 November 2014,](http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.113.226101) +## Making ppafm platform-independent. + +We propose to use [Docker](https://docs.docker.com/get-docker/) to make the code platform-independent. + +Here are the steps to build and run the ppafm Docker container: + +1. Build the image. + +```bash +$ docker build -t ppafm:latest . +``` +2. Execute the container. + +```bash +$ docker run --rm -it -v ${PWD}:/exec ppafm:latest +``` + ### License MIT diff --git a/pyproject.toml b/pyproject.toml index 9cc8baec..bdb1ffe4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,8 +20,7 @@ requires-python = ">=3.6" dependencies = [ "ase", "matplotlib", - "numpy", - "pyopencl", + "numpy<=1.21.6", # Remove upper limit when #76 is fixed. "reikna", ] @@ -29,6 +28,7 @@ dependencies = [ Homepage = "https://github.com/Probe-Particle/ProbeParticleModel" [project.optional-dependencies] +opencl = ["pyopencl"] dev = [ "pre-commit", "pytest",