Skip to content

Publish Docker Image #28

Publish Docker Image

Publish Docker Image #28

name: Publish Docker Image
on:
workflow_dispatch:
inputs:
mlflow_version:
description: 'MLflow version'
required: true
default: 'default'
type: string
push:
branches:
- main
paths:
- docker/**
pull_request:
paths:
- docker/**
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set variables
run: |
if [ "${{ inputs.mlflow_version }}" == "" ] || [ "${{ inputs.mlflow_version }}" == "default" ]; then
MLFLOW_VERSION=$(sed -n 's/^appVersion: //p' src/nebari_plugin_mlflow_aws/terraform/modules/mlflow/chart/Chart.yaml | tr -d '"')
else
MLFLOW_VERSION=${{ inputs.mlflow_version }}
fi
echo "MLFLOW_VERSION=${MLFLOW_VERSION}" >> ${GITHUB_ENV}
echo "GITHUB_RUN_ID=${GITHUB_RUN_ID}" >> ${GITHUB_ENV}
env | sort
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Github Packages container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ env.MLFLOW_VERSION }}-{{date 'YYYYMMDD-HHmm'}}
type=raw,value=${{ env.MLFLOW_VERSION }}
labels: |
runnumber=${{ env.GITHUB_RUN_ID }}
org.opencontainers.image.description=MLflow with AWS and Postgres dependencies
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: docker
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
sbom: false
provenance: false
build-args: |
MLFLOW_VERSION=${{ env.MLFLOW_VERSION }}