-
Notifications
You must be signed in to change notification settings - Fork 142
97 lines (90 loc) · 3.53 KB
/
Copy path_docker-build.yml
File metadata and controls
97 lines (90 loc) · 3.53 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
92
93
94
95
96
97
name: _Docker Build (reusable)
on:
workflow_call:
inputs:
push:
description: Whether to push images to GHCR
type: boolean
required: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# --- CPU ---
- runner: mt-rel-l-x86iavx512-8-64
platform: linux/amd64
base_image: quay.io/pypa/manylinux_2_28_x86_64
install_cuda: ""
variant_tag: cpu-x86_64
buildkit_addr: tcp://buildkitd-amd64.buildkit:1234
dockerfile: Dockerfile
- runner: mt-rel-l-arm64g4-16-62
platform: linux/arm64
base_image: quay.io/pypa/manylinux_2_28_aarch64
install_cuda: ""
variant_tag: cpu-aarch64
buildkit_addr: tcp://buildkitd-arm64.buildkit:1234
dockerfile: Dockerfile.aarch64
# --- CUDA (all versions in one image, self-hosted DinD runners) ---
- runner: mt-rel-l-x86iavx512-8-64
platform: linux/amd64
base_image: quay.io/pypa/manylinux_2_28_x86_64
install_cuda: "1"
variant_tag: cuda-x86_64
buildkit_addr: tcp://buildkitd-amd64.buildkit:1234
dockerfile: Dockerfile
- runner: mt-rel-l-arm64g4-16-62
platform: linux/arm64
base_image: quay.io/pypa/manylinux_2_28_aarch64
install_cuda: "1"
variant_tag: cuda-aarch64
buildkit_addr: tcp://buildkitd-arm64.buildkit:1234
dockerfile: Dockerfile.aarch64
container:
image: "ghcr.io/actions/actions-runner:latest"
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Log in to GHCR
if: inputs.push
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
with:
driver: remote
endpoint: ${{ matrix.buildkit_addr }}
- name: Docker meta
if: inputs.push
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=sha,prefix=${{ matrix.variant_tag }}-,format=short
type=raw,value=${{ matrix.variant_tag }}-latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: ./docker
file: ./docker/${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
push: ${{ inputs.push }}
tags: ${{ steps.meta.outputs.tags || '' }}
labels: ${{ steps.meta.outputs.labels || '' }}
build-args: |
BASE_IMAGE=${{ matrix.base_image }}
INSTALL_CUDA=${{ matrix.install_cuda }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ matrix.variant_tag }}
cache-to: ${{ inputs.push && format('type=registry,ref={0}/{1}:cache-{2},mode=max', env.REGISTRY, env.IMAGE_NAME, matrix.variant_tag) || '' }}