-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create build_and_push_image_to_dockerhub action
- Loading branch information
1 parent
6efbe7f
commit 2b55f7f
Showing
1 changed file
with
36 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to Docker hub | ||
uses: docker/login-action@v2.2.0 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Setup Java JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
java-package: 'jdk' | ||
distribution: 'adopt' | ||
|
||
- name: Build Book service Container Image | ||
run: mvn spring-boot:build-image -DskipTests -Dspring.flyway.enabled=false | ||
|
||
- name: Push to Docker Hub Container Resgisty | ||
run: | | ||
docker tag ${{ secrets.DOCKER_USERNAME }}/sempre-alerta:0.0.1-SNAPSHOT ${{ secrets.DOCKER_USERNAME }}/sempre-alerta:${{ github.run_id }} | ||
docker tag ${{ secrets.DOCKER_USERNAME }}/sempre-alerta:0.0.1-SNAPSHOT ${{ secrets.DOCKER_USERNAME }}/sempre-alerta:latest | ||
docker push ${{ secrets.DOCKER_USERNAME }}/sempre-alerta:${{ github.run_id }} | ||
docker push ${{ secrets.DOCKER_USERNAME }}/sempre-alerta:latest |