-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding GHA for automatic image build and push (#1615)
* Adding latest image tag * Update manifests with latest image tag * Add github actions for image build/push
- Loading branch information
1 parent
65ad3d5
commit 25c0872
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish Training Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
jobs: | ||
trial: | ||
name: Publish Image | ||
# Trigger workflow only for kubeflow/training-operator repository. | ||
if: github.repository == 'kubeflow/training-operator' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Publish Docker Images ${{ matrix.name }} | ||
uses: ./.github/workflows/template-publish-image | ||
with: | ||
image: docker.io/kubeflow/${{ matrix.name }} | ||
dockerfile: ${{ matrix.dockerfile }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- name: training-operator | ||
dockerfile: build/images/training-operator/Dockerfile | ||
# Add example images in the future |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Template run for publishing images. | ||
|
||
inputs: | ||
image: | ||
required: true | ||
type: string | ||
dockerfile: | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set Up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Docker Login | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ env.DOCKERHUB_USERNAME }} | ||
password: ${{ env.DOCKERHUB_TOKEN }} | ||
|
||
- name: Add Docker Tags | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ inputs.image }} | ||
tags: | | ||
type=raw,latest | ||
type=sha,prefix=v1- | ||
- name: Build and Push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ${{ inputs.dockerfile }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |