Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from kserve:main #1

Merged
merged 1 commit into from
Jan 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Push multi-arch docker image (#18)
cherry-picked from kserve/modelmesh#76

Signed-off-by: ddelange <14880945+ddelange@users.noreply.github.com>
  • Loading branch information
ddelange authored Jan 8, 2023
commit 75d8f4ce74c1cb4592787873e6021d8d4ad427a9
46 changes: 37 additions & 9 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [main]
tags:
- v*
pull_request:

jobs:
test:
Expand All @@ -22,22 +23,49 @@ jobs:
build:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push'

env:
IMAGE_NAME: kserve/rest-proxy
IMAGE_NAME: rest-proxy

steps:
- uses: actions/checkout@v2
- name: Build runtime image
run: make build
- name: Log in to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Push to Docker Hub

- name: Setup QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: export version variables
run: |
IMAGE_ID=kserve/$IMAGE_NAME

# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')

# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo $VERSION

# Strip "v" prefix from tag name
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')

# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest

docker tag ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:$VERSION
docker push ${{ env.IMAGE_NAME }}:$VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }}
target: runtime