Skip to content

Commit

Permalink
update prod build process
Browse files Browse the repository at this point in the history
  • Loading branch information
strangiato committed Sep 5, 2024
1 parent 105bcac commit 022a241
Showing 1 changed file with 17 additions and 53 deletions.
70 changes: 17 additions & 53 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,21 @@ on:
- 'mlflow-server/**'

jobs:

build:
name: Build Image
runs-on: ubuntu-latest
env:
BASE_IMAGE: 'registry.access.redhat.com/ubi9/python-311:latest'
REGISTRY: quay.io/troyer
IMAGE_NAME: mlflow-server
MAIN_TAG: latest-dev

steps:

- name: Checkout
uses: actions/checkout@v2

# Setup S2i and Build container image
- name: Setup and Build
id: build_image
uses: redhat-actions/s2i-build@v2
with:
path_context: 'mlflow-server'
builder_image: ${{ env.BASE_IMAGE }}
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.MAIN_TAG }}
get-version:
uses: ./.github/workflows/workflow-get-package-version.yaml
with:
context: "mlflow-server"
package: mlflow

- name: Retrieve version
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }}
run: |
FULL_VERSION=$(pip show mlflow | grep -i version | awk '{print $2}')
major=`echo $FULL_VERSION | cut -d. -f1`
minor=`echo $FULL_VERSION | cut -d. -f2`
revision=`echo $FULL_VERSION | cut -d. -f3`
MINOR_VERSION=$(echo "$major.$minor")
echo "::set-output name=FULL_VERSION::${FULL_VERSION}"
echo "::set-output name=MINOR_VERSION::${MINOR_VERSION}"
id: version

- name: Add tags
run: |
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:latest
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.FULL_VERSION }}
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.MINOR_VERSION }}
# Push Image to Quay registry
- name: Push To Quay Action
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }} latest ${{ steps.version.outputs.FULL_VERSION }} ${{ steps.version.outputs.MINOR_VERSION }}
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
build:
uses: ./.github/workflows/workflow-build-image.yaml
needs: get-version
with:
registry: quay.io/troyer
image-name: mlflow-server
context: "mlflow-server"
version-tag: ${{ needs.get-version.outputs.package-version }}
tag-suffix: ""
secrets:
registry-username: ${{ secrets.QUAY_USERNAME }}
registry-password: ${{ secrets.QUAY_PASSWORD }}

0 comments on commit 022a241

Please sign in to comment.