Skip to content

Build and Publish Docker Image #4

Build and Publish Docker Image

Build and Publish Docker Image #4

Workflow file for this run

name: Build and Publich Docker Image
on:
workflow_dispatch:
inputs:
version:
description: The image version
required: true
type: string
env:
IMAGE_NAME: befit
REGISTRY_URL: ghcr.io
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
IMAGE_TAG: $REGISTRY_URL/${{ github.actor }}/$IMAGE_NAME:${{ inputs.version }}
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag $IMAGE_TAG
working-directory: backend
- name: Login to Container registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY_URL -u ${{ github.actor }} --password-stdin
- name: Publish the Docker image
run: docker push $IMAGE_TAG