Skip to content

Commit

Permalink
Docker CICD
Browse files Browse the repository at this point in the history
  • Loading branch information
adhirajpandey authored Jun 12, 2024
1 parent 927ab05 commit 4c8f2cf
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,27 @@ name: Docker Image CI
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: adhirajpandey/bb:latest

- name: Build Docker image
- name: Trigger Jenkins CD Pipeline
run: |
IMAGE_NAME=${{ secrets.DOCKER_USER }}/budgetboss
docker build \
--file Dockerfile \
--tag $IMAGE_NAME:latest .
# Push the image with "latest" tag
docker push $IMAGE_NAME:latest
curl -H "Authorization: Bearer ${{ secrets.JENKINS_TRIGGER_TOKEN }}" ${{ secrets.JENKINS_WEBHOOK_TRIGGER_URL }}

0 comments on commit 4c8f2cf

Please sign in to comment.