Skip to content

Commit 13cd7d3

Browse files
authored
chore(CI): update GH Actions to only build multi-arch images (#50)
1 parent 2e445f4 commit 13cd7d3

2 files changed

Lines changed: 31 additions & 60 deletions

File tree

.github/workflows/build.yml

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,52 @@
1-
name: Multi-arch build
1+
name: Docker Build Test
22

33
on:
44
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**.md'
9+
pull_request:
10+
branches:
11+
- main
512
paths-ignore:
613
- '**.md'
714

8-
env:
9-
IMAGE_TAG: latest
10-
IMAGE_REGISTRY: quay.io
11-
IMAGE_REPOSITORY: crowdstrike/detection-container
15+
permissions:
16+
contents: read
1217

1318
jobs:
14-
build-multiarch-image:
15-
name: Build multi-architecture image
19+
docker-build-test:
1620
runs-on: ubuntu-latest
17-
permissions:
18-
contents: read
19-
21+
timeout-minutes: 20
2022
steps:
21-
- name: Install qemu dependency
22-
run: |
23-
sudo apt-get update
24-
sudo apt-get install -y qemu-user-static
25-
26-
- name: Checkout project
23+
- name: Checkout code
2724
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2825

29-
- name: Set up QEMU
30-
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
31-
3226
- name: Set up Docker Buildx
3327
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
34-
with:
35-
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
36-
37-
- name: Login to Docker Hub
38-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
39-
with:
40-
registry: ${{ env.IMAGE_REGISTRY }}
41-
username: ${{ secrets.REGISTRY_LOGIN }}
42-
password: ${{ secrets.REGISTRY_PASSWORD }}
4328

44-
- name: Build and push
45-
id: build_image_multiarch
29+
- name: Build multi-platform Docker image
4630
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
4731
with:
4832
context: .
49-
file: ./Dockerfile
50-
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
51-
push: true
33+
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
34+
push: false
35+
cache-from: type=gha
36+
cache-to: type=gha,mode=max
5237
tags: |
53-
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }}
38+
detection-container:test
39+
detection-container:pr-${{ github.event.pull_request.number }}
5440
55-
- name: Check manifest
41+
- name: Test Docker image (amd64)
5642
run: |
57-
docker buildx imagetools inspect ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }}
43+
docker buildx build \
44+
--platform linux/amd64 \
45+
--load \
46+
--tag detection-container:test-local \
47+
.
48+
49+
echo "Testing container starts successfully..."
50+
docker run --rm detection-container:test-local echo ok
51+
52+
echo "Docker image smoke tests passed!"

.github/workflows/container_build.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)