Skip to content

try for multi platform container #31

try for multi platform container

try for multi platform container #31

Workflow file for this run

name: Build Image
on:
push:
branches: [ "development" ]
pull_request:
branches: [ "development" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v4
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# if: github.event_name != 'pull_request'
# uses: docker/metadata-action@v5
# with:
# images: ghcr.io/ictu/pseudoniemenservice
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io/ictu/pseudoniemenservice
username: ictu
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
# if: matrix.platform != 'linux/amd64'
uses: docker/setup-qemu-action@v3
- name: Set up Pack
uses: buildpacks/github-actions/[email protected]
with:
pack-version: 0.35.1
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
- name: Build and publish OCI image
if: github.event_name != 'pull_request'
run: |
pack build ghcr.io/ictu/pseudoniemenservice-${{ matrix.platform }} \
--builder docker.io/paketobuildpacks/builder-jammy-buildpackless-tiny \
--buildpack gcr.io/paketo-buildpacks/java \
--path . \
--platform linux/${{ matrix.platform }} \
--report-output-dir ./report.toml \
--publish
#
# - name: Set up JDK
# uses: actions/setup-java@v4
# with:
# java-version: '21'
# distribution: "liberica"
# cache: maven
# - name: Build Native with Maven
# if: github.event_name != 'pull_request'
# run: mvn -ntp -B clean install spring-boot:build-image -Dspring-boot.build-image.imageName=ghcr.io/ictu/pseudoniemenservice:latest
#
# - name: Build with Maven
# if: github.event_name == 'pull_request'
# run: mvn -ntp -B clean install
#
# - name: Push docker image
# if: github.event_name != 'pull_request'
# run: |
# docker push --platform ${{ matrix.platform }} ghcr.io/ictu/pseudoniemenservice:lates
merge:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io/ictu/pseudoniemenservice
username: ictu
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
--tag ghcr.io/ictu/pseudoniemenservice ghcr.io/ictu/pseudoniemenservice-amd64 ghcr.io/ictu/pseudoniemenservice-arm64