From cdd79f77a24c97fb17c844963697514b65583080 Mon Sep 17 00:00:00 2001 From: Barry d'Hoine Date: Wed, 11 Dec 2024 01:35:39 +0100 Subject: [PATCH] Split up runners --- .github/workflows/build.yml | 33 +++++++++++++++------------------ Dockerfile | 5 ++--- README.md | 4 ++-- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 565fbe2..9810f5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,19 +1,13 @@ 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: permissions: contents: read packages: write @@ -21,7 +15,9 @@ jobs: 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 @@ -29,7 +25,7 @@ jobs: uses: actions/cache@v4 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 uses: actions/checkout@v4 with: @@ -41,25 +37,26 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + with: + platforms: linux/${{ matrix.arch }} - name: Log in to the Container registry 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 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 + 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 }} @@ -67,7 +64,7 @@ jobs: - name: Generate artifact attestation 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 diff --git a/Dockerfile b/Dockerfile index a138425..26505a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ FROM azul/zulu-openjdk:11-jre-headless -ARG TARGETOS -ARG TARGETARCH +ARG TARGETARCH=arm64 ARG AEMC_VERSION=2.0.3 ARG RUNMODE=author @@ -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 diff --git a/README.md b/README.md index 549e6bb..a9de016 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ mv ~/Downloads/aem-sdk-*.zip aem-sdk-artifacts/ Afterward you can build the image, by default and author is built. ```shell -docker buildx . -t aem-sdk:author +docker build . -t aem-sdk:author ``` And run the image @@ -49,7 +49,7 @@ docker run -p 4502:4502 -p 5005:14502 aem-sdk:author To build the publish image, you need to specify the correct build arguments. ```shell -docker buildx \ +docker build \ --build-arg RUNMODE=publish \ --build-arg PORT=4503 \ . -t aem-sdk:publish