Skip to content

Update JDK 20 github actions - build kotlin-service, build user-servi… #145

Update JDK 20 github actions - build kotlin-service, build user-servi…

Update JDK 20 github actions - build kotlin-service, build user-servi… #145

# This is a basic workflow to help you get started with Actions
name: CI - Build and push Docker images - Admin Service
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
if: contains(toJson(github), 'build admin-service')
name: Build Jar/Docker Image and Publish to DockerHub
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v2
# Set up JDK
- name: JDK
uses: actions/setup-java@v1
with:
java-version: 20
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Login to Dockerhub
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build Docker image using docker:build
- name: Build Service using docker:build
run: |
mvn clean package -DskipTests -Pkubernetes -q -pl admin-server -am -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn docker:build
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./admin-server/target/docker/admin-server/build
file: ./admin-server/target/docker/admin-server/build/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fielcapao/microservices-design-patterns-admin-service:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}