Skip to content

Update Dockerfile

Update Dockerfile #11

Workflow file for this run

name: .NET MVC CI/CD Pipeline
on:
push:
branches:
- main # Trigger on push to 'main' branch
pull_request:
branches:
- main # Trigger on pull request to 'main' branch
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
DOTNET_VERSION: 8.0
PUBLISH_DIR: ./publish
IMAGE_NAME: ragh2404/demomvcore # Docker image name
steps:
# Step 1: Check out code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up .NET
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
# Step 3: Restore dependencies
- name: Restore dependencies
run: dotnet restore
# Step 4: Build the solution
- name: Build the solution
run: dotnet build --configuration Release
# Step 6: Build Docker Image
- name: Build Docker Image
run: |
docker build -t ${{ env.IMAGE_NAME }}:latest .
# Step 7: Log in to DockerHub (or your preferred registry)
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: raghav2404l
password: Rr24042000#Rr
# Step 8: Push Docker image to DockerHub
- name: Push Docker Image to Docker Hub
run: |
docker push ${{ env.IMAGE_NAME }}:latest