5
5
- pull_request
6
6
7
7
jobs :
8
- build-and-publish :
9
- name : Build and Publish Images
8
+ build-and-publish-to-ghcr :
9
+ name : Build and Publish Images to Github Container Registry
10
10
runs-on :
11
11
labels : ubuntu-latest-16-cores
12
12
@@ -31,25 +31,26 @@ jobs:
31
31
- name : Checkout
32
32
uses : actions/checkout@v4
33
33
34
- - name : Docker Login
34
+ - name : GHCR Login
35
35
# Trigger workflow only for kubeflow/trainer repository with specific branch (master, release-*) or tag (v.*).
36
36
if : >-
37
37
github.repository == 'kubeflow/trainer' &&
38
38
(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/v'))
39
39
uses : docker/login-action@v3
40
40
with :
41
- username : ${{ secrets.DOCKERHUB_USERNAME }}
42
- password : ${{ secrets.DOCKERHUB_TOKEN }}
41
+ registry : ghcr.io
42
+ username : ${{ github.actor }}
43
+ password : ${{ secrets.GITHUB_TOKEN }}
43
44
44
- - name : Publish Component ${{ matrix.component-name }}
45
+ - name : Publish Component ${{ matrix.component-name }} to GHCR
45
46
# Trigger workflow only for kubeflow/trainer repository with specific branch (master, release-*) or tag (v.*).
46
47
if : >-
47
48
github.repository == 'kubeflow/trainer' &&
48
49
(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/v'))
49
50
id : publish
50
51
uses : ./.github/workflows/template-publish-image
51
52
with :
52
- image : docker .io/kubeflow/${{ matrix.component-name }}
53
+ image : ghcr .io/kubeflow/trainer /${{ matrix.component-name }}
53
54
dockerfile : ${{ matrix.dockerfile }}
54
55
platforms : ${{ matrix.platforms }}
55
56
context : ${{ matrix.context }}
59
60
if : steps.publish.outcome == 'skipped'
60
61
uses : ./.github/workflows/template-publish-image
61
62
with :
62
- image : docker.io/kubeflow/${{ matrix.component-name }}
63
+ image : ghcr.io/kubeflow/trainer/${{ matrix.component-name }}
64
+ dockerfile : ${{ matrix.dockerfile }}
65
+ platforms : ${{ matrix.platforms }}
66
+ context : ${{ matrix.context }}
67
+ push : false
68
+
69
+ build-and-publish-to-dockerhub :
70
+ name : Build and Publish Images to DockerHub
71
+ runs-on :
72
+ labels : ubuntu-latest-16-cores
73
+
74
+ strategy :
75
+ fail-fast : false
76
+ matrix :
77
+ include :
78
+ - component-name : trainer-controller-manager
79
+ dockerfile : cmd/trainer-controller-manager/Dockerfile
80
+ platforms : linux/amd64,linux/arm64,linux/ppc64le
81
+ - component-name : model-initializer
82
+ dockerfile : cmd/initializer/model/Dockerfile
83
+ platforms : linux/amd64,linux/arm64
84
+ - component-name : dataset-initializer
85
+ dockerfile : cmd/initializer/dataset/Dockerfile
86
+ platforms : linux/amd64,linux/arm64
87
+ - component-name : torchtune-trainer
88
+ dockerfile : cmd/trainers/torchtune/Dockerfile
89
+ platforms : linux/amd64,linux/arm64
90
+
91
+ steps :
92
+ - name : Docker Hub Login
93
+ if : >-
94
+ github.repository == 'kubeflow/trainer' &&
95
+ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/v'))
96
+ uses : docker/login-action@v3
97
+ with :
98
+ registry : docker.io
99
+ username : ${{ secrets.DOCKER_USERNAME }}
100
+ password : ${{ secrets.DOCKER_PASSWORD }}
101
+
102
+ - name : Publish Component ${{ matrix.component-name }} to Docker Hub
103
+ if : >-
104
+ github.repository == 'kubeflow/trainer' &&
105
+ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/v'))
106
+ id : publish-dockerhub
107
+ uses : ./.github/workflows/template-publish-image
108
+ with :
109
+ image : docker.io/kubeflow/trainer/${{ matrix.component-name }}
110
+ dockerfile : ${{ matrix.dockerfile }}
111
+ platforms : ${{ matrix.platforms }}
112
+ context : ${{ matrix.context }}
113
+ push : true
114
+
115
+ - name : Test Build For Component ${{ matrix.component-name }}
116
+ if : steps.publish.outcome == 'skipped'
117
+ uses : ./.github/workflows/template-publish-image
118
+ with :
119
+ image : docker.io/kubeflow/trainer/${{ matrix.component-name }}
63
120
dockerfile : ${{ matrix.dockerfile }}
64
121
platforms : ${{ matrix.platforms }}
65
122
context : ${{ matrix.context }}
0 commit comments