Skip to content

build: add Docker build (#592) #1

build: add Docker build (#592)

build: add Docker build (#592) #1

#
# Copyright (c) 2026 Metaform Systems, Inc.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
#
# Contributors:
# Metaform Systems, Inc. - initial API and implementation
#
---
name: "Publish Docker Images"
on:
push:
branches:
- main
tags:
- "*"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-push:
name: "Build and publish Docker images"
runs-on: ubuntu-latest
if: github.repository_owner == 'eclipse-edc'
strategy:
matrix:
include:
- name: controlplane
context: launchers/controlplane
dockerfile: launchers/controlplane/src/main/docker/Dockerfile
- name: issuerservice
context: launchers/issuerservice
dockerfile: launchers/issuerservice/src/main/docker/Dockerfile
- name: identity-hub
context: launchers/identity-hub
dockerfile: launchers/identity-hub/src/main/docker/Dockerfile
- name: dataplane
context: launchers/dataplane
dockerfile: launchers/dataplane/src/main/docker/Dockerfile
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set lowercase repository name
id: repo
run: |
repo_lowercase=$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')
echo "repo_lowercase=${repo_lowercase}" >> "$GITHUB_OUTPUT"
- name: Extract version from gradle.properties
id: version
run: |
version=$(grep '^version=' gradle.properties | cut -d'=' -f2)
echo "version=${version}" >> "$GITHUB_OUTPUT"
- uses: eclipse-edc/.github/.github/actions/setup-build@main
- name: Build JAR file
run: |
./gradlew -p ${{ matrix.context }} shadowJar
- name: Build and push image
uses: docker/build-push-action@v7
with:
build-args:
JAR=build/libs/${{ matrix.name }}.jar
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: true
tags: |
ghcr.io/${{ steps.repo.outputs.repo_lowercase }}/${{ matrix.name }}:latest
ghcr.io/${{ steps.repo.outputs.repo_lowercase }}/${{ matrix.name }}:${{ github.sha }}
ghcr.io/${{ steps.repo.outputs.repo_lowercase }}/${{ matrix.name }}:${{ steps.version.outputs.version }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
platforms: linux/amd64,linux/arm64