Skip to content

Build, Push and Deploy to Dev #5

Build, Push and Deploy to Dev

Build, Push and Deploy to Dev #5

Workflow file for this run

name: Build and Push Docker Image
on:
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build:
name: Build Image and Push to GitHub Container Registry
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: interviewandhealth
IMAGE_NAME: user-service
IMAGE_TAG: v${{ github.run_number }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
registry: ${{ env.DOCKER_REGISTRY }}
- name: Build Docker Image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.GITHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}