Skip to content
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
67 changes: 31 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,52 @@
name: Multi-arch build
name: Docker Build Test

on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'

env:
IMAGE_TAG: latest
IMAGE_REGISTRY: quay.io
IMAGE_REPOSITORY: crowdstrike/detection-container
permissions:
contents: read

jobs:
build-multiarch-image:
name: Build multi-architecture image
docker-build-test:
runs-on: ubuntu-latest
permissions:
contents: read

timeout-minutes: 20
steps:
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static

- name: Checkout project
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
with:
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le

- name: Login to Docker Hub
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push
id: build_image_multiarch
- name: Build multi-platform Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: ./Dockerfile
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
push: true
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }}
detection-container:test
detection-container:pr-${{ github.event.pull_request.number }}

- name: Check manifest
- name: Test Docker image (amd64)
run: |
docker buildx imagetools inspect ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker buildx build \
--platform linux/amd64 \
--load \
--tag detection-container:test-local \
.

echo "Testing container starts successfully..."
docker run --rm detection-container:test-local echo ok

echo "Docker image smoke tests passed!"
24 changes: 0 additions & 24 deletions .github/workflows/container_build.yml

This file was deleted.

Loading