Kafka Producer Consumer application #5
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
name: Build and Publish Docker Images | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build-app: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
java-package: jdk | |
architecture: x64 | |
cache: maven | |
- name: Build kafka apps with Maven | |
run: mvn clean package | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push Docker image for kafka-consumer | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./kafka-consumer | |
push: true | |
platforms: linux/arm64 # Specify platform for Mac M1 chip | |
tags: ${{ secrets.DOCKER_USERNAME }}/kafka-consumer:latest | |
- name: Build and Push Docker image for kafka-producer | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./kafka-producer | |
push: true | |
platforms: linux/arm64 # Specify platform for Mac M1 chip | |
tags: ${{ secrets.DOCKER_USERNAME }}/kafka-consumer:latest | |
- name: Log out from Docker Hub | |
run: docker logout | |
- name: Log out from Docker Hub | |
run: docker logout |