forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 238
91 lines (78 loc) · 2.64 KB
/
Copy pathdevcontainer.yml
File metadata and controls
91 lines (78 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Container
on:
push:
branches:
- develop
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
packages: write
concurrency:
group: container-${{ github.ref }}
cancel-in-progress: ${{ github.ref == 'refs/heads/develop' }}
defaults:
run:
shell: bash
jobs:
build_container_and_push:
name: Build and push (${{ matrix.dockerfile }})
runs-on: X64
if: >-
github.repository == 'deepmodeling/abacus-develop' &&
(github.ref == 'refs/heads/develop' ||
startsWith(github.ref, 'refs/tags/v'))
strategy:
fail-fast: false
matrix:
dockerfile:
- gnu
- intel
- cuda
steps:
- name: Configure Docker client
run: |
config_dir="${RUNNER_TEMP}/docker-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${{ matrix.dockerfile }}"
mkdir -p "${config_dir}"
echo "DOCKER_CONFIG=${config_dir}" >> "${GITHUB_ENV}"
- name: Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: |
ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}
dp-harbor-registry.us-east-1.cr.aliyuncs.com/deepmodeling/abacus-${{ matrix.dockerfile }}
flavor: |
latest=false
tags: |
type=semver,pattern={{version}},value=${{ github.ref_name }},enable=${{ github.ref_type == 'tag' }}
type=raw,value=latest
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
if: github.event_name != 'workflow_dispatch'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Aliyun Registry
if: github.event_name != 'workflow_dispatch'
uses: docker/login-action@v4
with:
registry: dp-harbor-registry.us-east-1.cr.aliyuncs.com
# AliCloud automatically mirrors this registry to registry.dp.tech.
username: ${{ secrets.DP_HARBOR_USERNAME }}
password: ${{ secrets.DP_HARBOR_PASSWORD }}
- name: Build and push container
uses: docker/build-push-action@v7
with:
context: "{{defaultContext}}"
file: Dockerfile.${{ matrix.dockerfile }}
push: ${{ github.event_name != 'workflow_dispatch' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=registry,ref=ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
cache-to: type=inline