From 63bef111cb36eb9d40314e4cf1091aace56180eb Mon Sep 17 00:00:00 2001 From: harmj0y Date: Thu, 19 Jun 2025 12:35:53 +0300 Subject: [PATCH] Build workflow with native runners -Build workflow with native runners instead of Qemu --- .github/workflows/docker-build.yml | 32 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 0b81b6e..e2ec3a5 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -12,16 +12,22 @@ on: env: REGISTRY: ghcr.io IMAGE_PREFIX: "specterops/nemesis" # ${{ github.repository }} causes issues as SpecterOps is not all lowercase - PLATFORMS: linux/amd64,linux/arm64 # Added platforms (arm64 for Mac M1/M2/M3 and AWS images) jobs: ### These base images never really change much, so commented out for now build-base-images: - runs-on: ubuntu-latest + runs-on: ${{ matrix.runner }} permissions: contents: read packages: write + strategy: + matrix: + include: + - runner: ubuntu-22.04 + platform: linux/amd64 + - runner: ubuntu-22.04-arm + platform: linux/arm64 outputs: python-base-dev-tag: ${{ steps.meta-python-base-dev.outputs.version }} python-base-prod-tag: ${{ steps.meta-python-base-prod.outputs.version }} @@ -30,9 +36,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -61,7 +64,7 @@ jobs: context: ./infra/docker/python_base file: ./infra/docker/python_base/dev.Dockerfile push: true - platforms: ${{ env.PLATFORMS }} + platforms: ${{ matrix.platform }} tags: ${{ steps.meta-python-base-dev.outputs.tags }} labels: ${{ steps.meta-python-base-dev.outputs.labels }} cache-from: type=gha @@ -84,7 +87,7 @@ jobs: context: ./infra/docker/python_base file: ./infra/docker/python_base/prod.Dockerfile push: true - platforms: ${{ env.PLATFORMS }} + platforms: ${{ matrix.platform }} tags: ${{ steps.meta-python-base-prod.outputs.tags }} labels: ${{ steps.meta-python-base-prod.outputs.labels }} cache-from: type=gha @@ -107,7 +110,7 @@ jobs: context: ./projects/InspectAssembly file: ./projects/InspectAssembly/Dockerfile push: true - platforms: ${{ env.PLATFORMS }} + platforms: ${{ matrix.platform }} tags: ${{ steps.meta-inspect-assembly.outputs.tags }} labels: ${{ steps.meta-inspect-assembly.outputs.labels }} cache-from: type=gha @@ -115,12 +118,17 @@ jobs: build-service-images: needs: build-base-images - runs-on: ubuntu-latest + runs-on: ${{ matrix.runner }} permissions: contents: read packages: write strategy: matrix: + include: + - runner: ubuntu-22.04 + platform: linux/amd64 + - runner: ubuntu-22.04-arm + platform: linux/arm64 service: - name: web-api context: . @@ -159,10 +167,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - # TODO: test if the noseyparker build takes too long for ARM - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -189,7 +193,7 @@ jobs: context: ${{ matrix.service.context }} file: ${{ matrix.service.dockerfile }} push: true - platforms: ${{ env.PLATFORMS }} # TODO: test if the noseyparker build takes too long for ARM + platforms: ${{ matrix.platform }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: |