-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If Docker CI Changes, then Run the CI for Docker in PR
- Loading branch information
Showing
1 changed file
with
8 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ on: | |
paths: | ||
- "./Dockerfile" | ||
- "./.github/workflows/docker_build.yml" | ||
types: [opened, synchronize, reopened, ready_for_review, review_requested] | ||
|
||
|
||
jobs: | ||
build: | ||
|
@@ -39,8 +41,9 @@ jobs: | |
|
||
# Conditional step for building image without pushing, for PRs | ||
- name: Build Docker Image (No Push) | ||
if: github.event_name == 'pull_request' | ||
uses: docker/build-push-action@v2 | ||
# if condition is pull request or push then it will build the image | ||
if: github.event_name == 'pull_request' || github.event_name == 'push' | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
|
@@ -49,18 +52,18 @@ jobs: | |
# Conditional steps for building and pushing, for pushes to main | ||
- name: Login to Docker Hub | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
uses: docker/login-action@v1 | ||
uses: docker/login-action@v3.0.0 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
uses: docker/setup-buildx-action@v1 | ||
uses: docker/setup-buildx-action@v3.0.0 | ||
|
||
- name: Build and Push Docker Image | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
uses: docker/build-push-action@v2 | ||
uses: docker/build-push-action@v5.1.0 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
|