forked from KanuaK/triton-ascend
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (82 loc) · 3.48 KB
/
Copy pathbuild-docker-image.yml
File metadata and controls
91 lines (82 loc) · 3.48 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: Release Triton Ascend Images
on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'docker/Dockerfile'
- 'requirements.txt'
- 'requirements_dev.txt'
- '.github/workflows/build-docker-image.yml'
pull_request:
branches: [main]
paths:
- 'docker/Dockerfile'
- 'requirements.txt'
- 'requirements_dev.txt'
- '.github/workflows/build-docker-image.yml'
concurrency:
group: build-docker-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
actions: write
jobs:
build-images:
name: Build ${{ matrix.cann_version }}-${{ matrix.chip_type }}-${{ matrix.os }}-py${{ matrix.python_version }}-${{ matrix.platforms }}
# Use buildkit runner matching the target platform.
runs-on: ${{ matrix.platforms == 'amd64' && 'linux-amd64-cpu-4' || 'linux-aarch64-cpu-4' }}
container:
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:9.0.0-a3-ubuntu22.04-py3.12
timeout-minutes: 360
strategy:
fail-fast: false
# Limit parallelism: too many concurrent builds overwhelm the shared
# buildkitd workers and SWR (auth timeouts / connection resets).
max-parallel: 6
matrix:
cann_version: [8.5.0, 9.0.0-beta.2]
chip_type: [910b, a3]
os: [ubuntu22.04]
python_version: ["3.10", "3.11"]
platforms: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
symlinks: true
- name: Login to Quay.io
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASSWD }}
- name: Generate tags
id: tags
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
CANN_TAG="${{ matrix.cann_version }}-${{ matrix.chip_type }}-${{ matrix.os }}-py${{ matrix.python_version }}"
GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)"
TAG_COMMIT="${CANN_TAG}-${GIT_COMMIT_SHORT}"
TAG_LATEST="${CANN_TAG}-latest"
echo "cann_tag=${CANN_TAG}" >> $GITHUB_OUTPUT
echo "tag_commit=${TAG_COMMIT}" >> $GITHUB_OUTPUT
echo "tag_latest=${TAG_LATEST}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: docker/Dockerfile
push: ${{ github.event_name == 'push' }}
tags: |
quay.io/ascend/triton:${{ steps.tags.outputs.tag_commit }}-${{ matrix.platforms }}
quay.io/ascend/triton:${{ steps.tags.outputs.tag_latest }}-${{ matrix.platforms }}
build-args: |
CANN_BASE_IMAGE=swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:${{ steps.tags.outputs.cann_tag }}
APTMIRROR=http://cache-service.nginx-pypi-cache.svc.cluster.local:8081
PIP_INDEX_URL=http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple
PIP_TRUSTED_HOST=cache-service.nginx-pypi-cache.svc.cluster.local
TORCH_INDEX_URL=http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu
cache-from: type=registry,ref=swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/triton-buildcache:${{ matrix.cann_version }}-${{ matrix.platforms }}
cache-to: type=registry,ref=swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/triton-buildcache:${{ matrix.cann_version }}-${{ matrix.platforms }},mode=max