Skip to content

Commit

Permalink
feat: Create build_and_push_image_to_dockerhub action
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusVict authored Mar 1, 2024
1 parent 6efbe7f commit 2b55f7f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build_and_push_image_to_dockerhub.yml
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

0 comments on commit 2b55f7f

Please sign in to comment.