Skip to content

Commit 22e77ae

Browse files
authored
Build(docker): add an image for running abacus. (#941)
1 parent e51a0a3 commit 22e77ae

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

.github/workflows/container.yml renamed to .github/workflows/devcontainer.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
- name: Login to Aliyun Registry
3030
uses: docker/login-action@v1
3131
with:
32-
registry: ${{ secrets.DP_HARBOR_REGISTRY }}
33-
username: ${{ secrets.DP_HARBOR_USERNAME }}
32+
registry: ${{ secrets.DP_HARBOR_REGISTRY }}
33+
username: ${{ secrets.DP_HARBOR_USERNAME }}
3434
password: ${{ secrets.DP_HARBOR_PASSWORD }}
3535

3636
- name: Build and Push Container

.github/workflows/image.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build Image
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
build_container_and_push:
10+
runs-on: ubuntu-latest
11+
if: github.repository_owner == 'deepmodeling'
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Setup Docker Buildx
17+
uses: docker/setup-buildx-action@v1
18+
19+
- name: Login to GitHub Container Registry
20+
uses: docker/login-action@v1
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Login to Aliyun Registry
27+
uses: docker/login-action@v1
28+
with:
29+
registry: ${{ secrets.DP_HARBOR_REGISTRY }}
30+
username: ${{ secrets.DP_HARBOR_USERNAME }}
31+
password: ${{ secrets.DP_HARBOR_PASSWORD }}
32+
33+
- name: Build and Push Container
34+
uses: docker/build-push-action@v2
35+
with:
36+
tags: |
37+
ghcr.io/${{ github.repository_owner }}/abacus:latest
38+
${{ secrets.DP_HARBOR_REGISTRY }}/dplc/abacus:latest
39+
file: Dockerfile
40+
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/abacus:latest
41+
cache-to: type=inline
42+
push: true

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To build this docker file, run `docker build -t abacus - < Dockerfile`.
2+
FROM ubuntu:latest
3+
RUN apt update && apt install -y --no-install-recommends libopenblas-dev liblapack-dev libscalapack-mpi-dev libelpa-dev libfftw3-dev libcereal-dev libxc-dev g++ make cmake bc time sudo vim git
4+
# If you wish to use the LLVM compiler, replace 'g++' above with 'clang libomp-dev'.
5+
RUN GIT_SSL_NO_VERIFY=true git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && cd abacus-develop && cmake -B build && cmake --build build -j`nproc` && cmake --install build && cd .. && rm -rf abacus-develop
6+
# If you have trouble cloning repo, replace "github.com" with "gitee.com".
7+
ENV OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 OMPI_MCA_btl_vader_single_copy_mechanism=none
8+
CMD mpirun --use-hwthread-cpus abacus
9+
10+
# To run ABACUS built by this image with all available threads, execute `docker run -v <host>:<wd> -w <wd/input> abacus`.
11+
# Replace '<host>' with the path to all files(including pseudopotential files), '<wd>' with a path to working directory, and '<wd/input>' with the path to input folder(containing 'INPUT', 'STRU', etc.).
12+
# e.g. after clone the repo to `$HOME` and pulled this image, execute `docker run -v ~/abacus-develop/tests/integrate:/workspace -w /workspace/101_PW_15_f_pseudopots abacus`.
13+
# To run ABACUS with a given MPI process number, execute `docker run -v <host>:<wd> -w <wd/input> -it --entrypoint mpirun abacus -np <processes> abacus`. Note: the first "abacus" is the name of the image, the second "abacus" is the name of the executable file. Do not use '--cpus' flag of 'docker run' to specify the number of processes.
14+
15+
# To use this image as developing environment, execute `docker run -it --entrypoint /bin/bash abacus`.
16+
# Please refer to https://docs.docker.com/engine/reference/commandline/run/ for more details.

0 commit comments

Comments
 (0)