Skip to content

Create and publish a image #12

Create and publish a image

Create and publish a image #12

name: Create and publish a image
on:
workflow_dispatch:
inputs:
tag:
description: "Tag"
required: true
type: string
dockerfile:
description: "Dockerfile"
required: true
type: string
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to the Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: yezhengmaolove/mlora
tags: type=raw,value=${{ inputs.tag }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
push: true
context: .
tags: ${{ steps.meta.outputs.tags }}
file: ./${{ inputs.dockerfile }}