Skip to content

chore: Github Action to build and push Docker images for both arm64 a… #1

chore: Github Action to build and push Docker images for both arm64 a…

chore: Github Action to build and push Docker images for both arm64 a… #1

Workflow file for this run

# derived from https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions
name: Create and publish Docker image
on:
push:
branches:
- master
- feature/*
tags:
- v*
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/homedatabroker
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build with Maven
run: mvn -Duser.timezone=Europe/Berlin --batch-mode --update-snapshots package
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
file: Dockerfile
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64