Skip to content

Commit 1c7b7ef

Browse files
committed
[build] Add Dockerfile for TNSP project.
Add Dockerfile for TNSP and the github action script to build it and push it to DockerHub.
1 parent 5bfe42f commit 1c7b7ef

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

.github/workflows/docker.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: docker
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: checkout
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- name: recovery tag information
17+
run: git fetch origin --depth=1 +refs/tags/*:refs/tags/*
18+
- name: set up qemu
19+
uses: docker/setup-qemu-action@v3
20+
- name: set up docker buildx
21+
uses: docker/setup-buildx-action@v3
22+
- name: login to docker hub
23+
uses: docker/login-action@v3
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_TOKEN }}
27+
- name: build and push
28+
uses: docker/build-push-action@v6
29+
with:
30+
context: .
31+
platforms: linux/amd64,linux/arm64
32+
push: true
33+
tags: |
34+
${{ secrets.DOCKERHUB_USERNAME }}/tnsp:latest
35+
${{ secrets.DOCKERHUB_USERNAME }}/tnsp:${{ github.sha }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
!/LICENSE.rst
2121
!/README.org
2222
!/README_zh.org
23+
!/Dockerfile
2324

2425
_minted-*
2526
build

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:3.12
2+
RUN apt update
3+
RUN apt install --yes libopenblas-dev libopenmpi-dev
4+
RUN pip install build
5+
COPY . TNSP
6+
RUN python -m build TNSP/PyTAT -o dist -v
7+
RUN python -m build TNSP/lazy_graph -o dist -v
8+
RUN python -m build TNSP/PyScalapack -o dist -v
9+
RUN python -m build TNSP/tetragono -o dist -v
10+
RUN python -m build TNSP/tetraku -o dist -v
11+
RUN python -m build TNSP/tnsp_bridge -o dist -v
12+
RUN pip install dist/*.whl
13+
RUN pip install torch openfermion

0 commit comments

Comments
 (0)