From 13d29c374ae7366d1c3f696778707785735a613b Mon Sep 17 00:00:00 2001 From: AryanSharma9917 Date: Thu, 15 Aug 2024 15:52:45 +0530 Subject: [PATCH] Add CI/CD pipeline for Docker image --- .github/workflows/docker-image.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..aa65f55 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,36 @@ +name: CI/CD Pipeline for Docker + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: aryansharma04/systemmonitoring:latest + + - name: Clean up images + run: docker image prune -af