Skip to content

Commit 2dcba24

Browse files
committed
Improved and simplified dockerfile and its readme
1 parent e79471e commit 2dcba24

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

docker/README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# Docker setup for OpenFermion and select plugins
22

33
This Docker image contains [OpenFermion](https://github.com/quantumlib/OpenFermion)
4-
and its available plugins for
5-
[Cirq](https://github.com/quantumlib/Cirq),
6-
[Psi4](https://github.com/quantumlib/OpenFermion-Psi4), and
7-
[PySCF](https://github.com/quantumlib/OpenFermion-PySCF).
4+
and its several available plugins.
85
Check out Docker's [website](https://www.docker.com/what-container) for a description of
96
what a container image is and why it can be so useful.
107
The Docker-based installation is extremely robust and runs on any operating
@@ -18,17 +15,13 @@ OpenFermion (or any of its plugins) using the standard procedure.
1815
- Python 3.12
1916
- [Miniforge](https://github.com/conda-forge/miniforge)
2017
- [OpenFermion](https://github.com/quantumlib/OpenFermion)
21-
- [Cirq](https://github.com/quantumlib/Cirq)
2218
- [Psi4](http://www.psicode.org)
23-
- [PySCF](https://github.com/sunqm/pyscf)
24-
- [OpenFermion-Cirq](https://github.com/quantumlib/OpenFermion-Cirq)
2519
- [OpenFermion-Psi4](https://github.com/quantumlib/OpenFermion-Psi4)
2620
- [OpenFermion-PySCF](https://github.com/quantumlib/OpenFermion-PySCF)
2721

2822

2923
## Setting up Docker for the first time
3024
The Dockerfile is based on the [Ubuntu image](https://hub.docker.com/_/ubuntu) (ver. 22.04).
31-
Two Linux architectures are supported in the Dockerfile: x86_64 (amd64) and aarch64 (arm64).
3225
Detecting your host's architecture is handled automatically through the following docker image building process, so you don't have to check it manually.
3326
It creates a Python (ver. 3.12) virtual environment (named `fermion`) using Miniforge and installs all dependencies within it. Psi4 is installed with a [conda command](https://psicode.org/installs/v191/).
3427

@@ -45,8 +38,7 @@ docker build -t openfermion_docker .
4538
where "openfermion_docker" is just an arbitrary name for our docker image.
4639
Building the Dockerfile starts from a base image of Ubuntu and then installs
4740
OpenFermion, its plugins, and the necessary applications needed for running these
48-
programs. This is a fairly involved setup and will take some time
49-
(perhaps up to thirty minutes, depending on the computer) and disk space (several gigabytes).
41+
programs. This will take few minutes (depending on the computer) and disk space (several gigabytes).
5042

5143
Line 18 in the Dockerfile
5244
```

docker/dockerfile

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,28 @@ COPY . /root/workspace
1919

2020
# Set PATH for miniforge
2121
ENV PATH="/root/conda/bin:${PATH}"
22-
# Set PATH for pyscf
23-
ENV PYTHONPATH=/root/pyscf
2422

2523
RUN apt-get update && \
26-
apt-get install -y --no-install-recommends bzip2=1.0.8-5build1 \
27-
cmake=3.22.1-1ubuntu1.22.04.2 \
28-
git=1:2.34.1-1ubuntu1.15 \
24+
apt-get install -y --no-install-recommends git=1:2.34.1-1ubuntu1.15 \
2925
wget=1.21.2-2ubuntu1.1 \
3026
libblas-dev=3.10.0-2ubuntu1 \
3127
liblapack-dev=3.10.0-2ubuntu1 \
3228
# in order to verify github's certificate
3329
ca-certificates=20240203~22.04.1 \
34-
build-essential=12.9ubuntu3
30+
build-essential=12.9ubuntu3 && \
31+
# delete the apt-get lists after the installation
32+
apt-get clean && \
33+
rm -rf /var/lib/apt/lists/*
3534

3635
# Install miniforge https://github.com/conda-forge/miniforge?tab=readme-ov-file#as-part-of-a-ci-pipeline
3736
RUN wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/download/25.3.1-0/Miniforge3-25.3.1-0-$(uname)-$(uname -m).sh" && \
3837
bash Miniforge3.sh -b -p "${HOME}/conda" && \
38+
rm Miniforge3.sh && \
3939
conda init bash && \
40-
conda update -n base -c conda-forge conda && \
4140
# Create virtual env (fermion) with installing Psi4
42-
conda create -n fermion psi4 python=3.12 -c conda-forge -y && \
43-
conda install -n fermion pip -y && \
44-
# Install OpenFermion, Cirq, and plugins
45-
conda run -n fermion pip install openfermion \ cirq \ openfermioncirq \ openfermionpsi4 \ openfermionpyscf
46-
47-
# Install PySCF
48-
WORKDIR /root
49-
RUN git clone https://github.com/sunqm/pyscf
50-
WORKDIR /root/pyscf/pyscf/lib/build
51-
RUN cmake .. && \
52-
make
41+
conda create -n fermion psi4==1.10 python=3.12 -c conda-forge -y && \
42+
# Install OpenFermion and plugins
43+
conda install -n fermion -c conda-forge openfermion==1.7.1 openfermionpsi4==0.5 openfermionpyscf==0.5 -y
5344

5445
# Activate venv (fermion)
5546
RUN echo "conda activate fermion" >> ~/.bashrc

0 commit comments

Comments
 (0)