55 branches :
66 - develop
77 tags :
8- - ' v* '
8+ - " v* "
99 workflow_dispatch :
1010
1111permissions :
@@ -14,125 +14,78 @@ permissions:
1414
1515concurrency :
1616 group : container-${{ github.ref }}
17- cancel-in-progress : true
17+ cancel-in-progress : ${{ github.ref == 'refs/heads/develop' }}
1818
1919defaults :
2020 run :
2121 shell : bash
2222
2323jobs :
24- build_container_and_push_cpu :
25- runs-on : [self-hosted,cpu]
26- if : github.repository_owner == 'deepmodeling'
27- strategy :
28- matrix :
29- dockerfile : ["gnu","intel"]
30- env :
31- DOCKER_CONFIG : >-
32- ${{ runner.temp }}/docker-${{ github.run_id }}-${{ matrix.dockerfile }}
33- steps :
34- - name : Force Clean Workspace
35- run : |
36- sudo chattr -i -R ${{ github.workspace }} 2>/dev/null || true
37- sudo chown -R $USER:$USER ${{ github.workspace }}
38- sudo find ${{ github.workspace }} -mindepth 1 -delete
39-
40- - name : Checkout
41- uses : actions/checkout@v7
42-
43- - name : Docker meta
44- id : meta
45- uses : docker/metadata-action@v6
46- with :
47- images : |
48- ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}
49- dp-harbor-registry.us-east-1.cr.aliyuncs.com/deepmodeling/abacus-${{ matrix.dockerfile }}
50- tags : |
51- type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }}
52- type=raw,value=latest
53-
54- - name : Setup Docker Buildx
55- uses : docker/setup-buildx-action@v4
56-
57- - name : Login to GitHub Container Registry
58- uses : docker/login-action@v4
59- with :
60- registry : ghcr.io
61- username : ${{ github.actor }}
62- password : ${{ secrets.GITHUB_TOKEN }}
24+ build_container_and_push :
25+ name : Build and push (${{ matrix.dockerfile }})
26+ runs-on : X64
6327
64- - name : Login to Aliyun Registry
65- uses : docker/login-action@v4
66- with :
67- registry : dp-harbor-registry.us-east-1.cr.aliyuncs.com
68- # AliCloud automatically mirrors to registry.dp.tech
69- username : ${{ secrets.DP_HARBOR_USERNAME }}
70- password : ${{ secrets.DP_HARBOR_PASSWORD }}
28+ if : >-
29+ github.repository == 'deepmodeling/abacus-develop' &&
30+ (github.ref == 'refs/heads/develop' ||
31+ startsWith(github.ref, 'refs/tags/v'))
7132
72- - name : Build and Push Container
73- uses : docker/build-push-action@v7
74- with :
75- tags : ${{ steps.meta.outputs.tags }}
76- labels : ${{ steps.meta.outputs.labels }}
77- file : Dockerfile.${{ matrix.dockerfile }}
78- push : true
79- cache-from : type=registry,ref=ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
80- cache-to : type=inline
81-
82- build_container_and_push_gpu :
83- runs-on : [self-hosted,gpu]
84- if : github.repository_owner == 'deepmodeling'
8533 strategy :
34+ fail-fast : false
8635 matrix :
87- dockerfile : ["cuda"]
88- env :
89- DOCKER_CONFIG : >-
90- ${{ runner.temp }}/docker-${{ github.run_id }}-${{ matrix.dockerfile }}
36+ dockerfile :
37+ - gnu
38+ - intel
39+ - cuda
40+
9141 steps :
92- - name : Force Clean Workspace
42+ - name : Configure Docker client
9343 run : |
94- sudo chattr -i -R ${{ github.workspace }} 2>/dev/null || true
95- sudo chown -R $USER:$USER ${{ github.workspace }}
96- sudo find ${{ github.workspace }} -mindepth 1 -delete
97-
98- - name : Checkout
99- uses : actions/checkout@v7
44+ config_dir="${RUNNER_TEMP}/docker-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${{ matrix.dockerfile }}"
45+ mkdir -p "${config_dir}"
46+ echo "DOCKER_CONFIG=${config_dir}" >> "${GITHUB_ENV}"
10047
101- - name : Docker meta
48+ - name : Docker metadata
10249 id : meta
10350 uses : docker/metadata-action@v6
10451 with :
10552 images : |
10653 ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}
10754 dp-harbor-registry.us-east-1.cr.aliyuncs.com/deepmodeling/abacus-${{ matrix.dockerfile }}
55+ flavor : |
56+ latest=false
10857 tags : |
109- type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }}
58+ type=semver,pattern={{version}},value=${{ github.ref_name }}, enable=${{ github.ref_type == 'tag' }}
11059 type=raw,value=latest
11160
11261 - name : Setup Docker Buildx
11362 uses : docker/setup-buildx-action@v4
11463
11564 - name : Login to GitHub Container Registry
65+ if : github.event_name != 'workflow_dispatch'
11666 uses : docker/login-action@v4
11767 with :
11868 registry : ghcr.io
11969 username : ${{ github.actor }}
12070 password : ${{ secrets.GITHUB_TOKEN }}
12171
12272 - name : Login to Aliyun Registry
73+ if : github.event_name != 'workflow_dispatch'
12374 uses : docker/login-action@v4
12475 with :
12576 registry : dp-harbor-registry.us-east-1.cr.aliyuncs.com
126- # AliCloud automatically mirrors to registry.dp.tech
77+ # AliCloud automatically mirrors this registry to registry.dp.tech.
12778 username : ${{ secrets.DP_HARBOR_USERNAME }}
12879 password : ${{ secrets.DP_HARBOR_PASSWORD }}
12980
130- - name : Build and Push Container
81+ - name : Build and push container
13182 uses : docker/build-push-action@v7
13283 with :
84+ context : " {{defaultContext}}"
85+ file : Dockerfile.${{ matrix.dockerfile }}
86+ push : ${{ github.event_name != 'workflow_dispatch' }}
13387 tags : ${{ steps.meta.outputs.tags }}
13488 labels : ${{ steps.meta.outputs.labels }}
135- file : Dockerfile.${{ matrix.dockerfile }}
136- push : true
137- cache-from : type=registry,ref=ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
89+ cache-from : |
90+ type=registry,ref=ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
13891 cache-to : type=inline
0 commit comments