Skip to content

Workflow file for this run

name: Build and Publish Docker Images
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-consumer:
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-consumer with Maven
run: mvn clean package -f kafka-consumer/pom.xml -Dmaven.test.skip=true
- 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: Log out from Docker Hub
run: docker logout
build-producer:
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-producer with Maven
run: mvn clean package -f kafka-producer/pom.xml -Dmaven.test.skip=true
- 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-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-producer:latest
- name: Log out from Docker Hub
run: docker logout