Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dedicated build nodes in order to have arm64 image builds in the future #1

Merged
merged 5 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 48 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
name: Create and publish AEM images

on:
push:
branches: ["main"]
workflow_dispatch:
on: [ push ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
AEM_SDK_VERSION: 2024.10.18459.20241031T210302Z-241000
registry: ghcr.io
aem_sdk_version: 2024.10.18459.20241031T210302Z-241000

jobs:
build-and-push-image:
name: Build and push AEM image
runs-on: ubuntu-latest
build-images:
name: Build images
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
runmode: ["author", "publish"]
arch: [ arm64, amd64 ]
runmode: [ author, publish ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache SDK
uses: actions/cache@v4
id: cache-sdk
with:
path: aem-sdk-artifacts
key: aem-sdk-${{ env.AEM_SDK_VERSION }}.zip
key: aem-sdk-${{ env.aem_sdk_version }}.zip
- name: Checkout AEM SDK artifacts repository
if: steps.cache-sdk.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: orbinson/aem-sdk-artifacts
Expand All @@ -41,33 +40,62 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
with:
platforms: linux/${{ matrix.arch }}
- name: Log in to the container registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.registry }}/${{ github.repository }}
- name: Build and push docker image
id: push
id: build-push-image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ matrix.runmode }}-${{ env.AEM_SDK_VERSION }}
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ env.registry }}/${{ github.repository }}:${{ matrix.runmode }}-${{ env.aem_sdk_version }}-${{ matrix.arch }}
platforms: linux/${{ matrix.arch }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
RUNMODE=${{ matrix.runmode }}
PORT=${{ matrix.runmode == 'author' && '4502' || '4503' }}
- name: Generate artifact attestation
if: github.ref == 'refs/heads/main'
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-name: ${{ env.registry }}/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

manifest:
name: Create manifest
if: github.ref == 'refs/heads/main'
permissions:
packages: write
id-token: write
strategy:
matrix:
arch: [ arm64, amd64 ]
runs-on: ubuntu-latest
needs: build-images
steps:
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ${{ env.registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push manifest to registry
run: |
IMAGE=${{ env.registry }}/${{ github.repository }}:${{ matrix.runmode }}-${{ env.aem_sdk_version }}
docker manifest create \
${IMAGE} \
--amend ${IMAGE}-amd64 \
--amend ${IMAGE}-arm64
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM azul/zulu-openjdk:11-jre-headless

ARG TARGETOS
ARG TARGETARCH

ARG AEMC_VERSION=2.0.3
Expand All @@ -19,7 +18,7 @@ RUN apt-get update &&\
apt-get install -y --no-install-recommends curl &&\
apt-get clean &&\
rm -rf /var/cache/apk/* &&\
curl -L https://github.com/wttech/aemc/releases/download/v${AEMC_VERSION}/aemc-cli_${TARGETOS}_${TARGETARCH}.tar.gz | tar -xz -C /usr/local/bin
curl -L https://github.com/wttech/aemc/releases/download/v${AEMC_VERSION}/aemc-cli_linux_${TARGETARCH}.tar.gz | tar -xz -C /usr/local/bin

COPY aem-sdk-artifacts/aem-sdk-*.zip aem/home/lib/
COPY aem/default/etc/aem.yml aem/default/etc/aem.yml
Expand Down
Loading