Skip to content

Commit 8b05349

Browse files
committed
feat: add bcc support
1 parent 1d6684f commit 8b05349

2 files changed

Lines changed: 50 additions & 12 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99

1010
env:
1111
REGISTRY: docker.io
12-
IMAGE_NAME: johnlin/bpfshoot
1312

1413
jobs:
1514
build:
@@ -20,6 +19,16 @@ jobs:
2019
id-token: write
2120
attestations: write
2221

22+
strategy:
23+
matrix:
24+
include:
25+
- dockerfile: Dockerfile
26+
image_name: johnlin/bpfshoot
27+
image_suffix: ""
28+
- dockerfile: Dockerfile.bcc
29+
image_name: johnlin/bpfshoot
30+
image_suffix: "-bcc"
31+
2332
steps:
2433
- name: Checkout repository
2534
uses: actions/checkout@v4
@@ -39,32 +48,32 @@ jobs:
3948
id: meta
4049
uses: docker/metadata-action@v5
4150
with:
42-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
51+
images: ${{ env.REGISTRY }}/${{ matrix.image_name }}
4352
tags: |
44-
type=ref,event=branch
45-
type=ref,event=pr
46-
type=semver,pattern={{version}}
47-
type=semver,pattern={{major}}.{{minor}}
48-
type=sha,prefix=sha-,format=short
49-
type=raw,value=latest,enable={{is_default_branch}}
53+
type=ref,event=branch,suffix=${{ matrix.image_suffix }}
54+
type=ref,event=pr,suffix=${{ matrix.image_suffix }}
55+
type=semver,pattern={{version}},suffix=${{ matrix.image_suffix }}
56+
type=semver,pattern={{major}}.{{minor}},suffix=${{ matrix.image_suffix }}
57+
type=sha,prefix=sha-,format=short,suffix=${{ matrix.image_suffix }}
58+
type=raw,value=latest${{ matrix.image_suffix }},enable={{is_default_branch}}
5059
5160
- name: Build and push Docker image
5261
id: build
5362
uses: docker/build-push-action@v5
5463
with:
5564
context: .
56-
file: ./Dockerfile
65+
file: ./${{ matrix.dockerfile }}
5766
platforms: linux/amd64,linux/arm64
5867
push: ${{ github.event_name != 'pull_request' }}
5968
tags: ${{ steps.meta.outputs.tags }}
6069
labels: ${{ steps.meta.outputs.labels }}
61-
cache-from: type=gha
62-
cache-to: type=gha,mode=max
70+
cache-from: type=gha,scope=${{ matrix.dockerfile }}
71+
cache-to: type=gha,mode=max,scope=${{ matrix.dockerfile }}
6372

6473
- name: Generate artifact attestation
6574
if: github.event_name != 'pull_request'
6675
uses: actions/attest-build-provenance@v1
6776
with:
68-
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
77+
subject-name: ${{ env.REGISTRY }}/${{ matrix.image_name }}
6978
subject-digest: ${{ steps.build.outputs.digest }}
7079
push-to-registry: true

Dockerfile.bcc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM debian:sid
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
bash \
5+
curl \
6+
ca-certificates \
7+
git \
8+
jq \
9+
procps \
10+
net-tools \
11+
iproute2 \
12+
vim \
13+
python3-pip \
14+
apt-transport-https
15+
bpfcc-tools \
16+
libbpfcc \
17+
libbpfcc-dev \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
# dnslib and cachetools are required for some BCC tools
21+
RUN pip3 install dnslib cachetools --break-system-packages
22+
23+
# Setting User and Home
24+
USER root
25+
WORKDIR /root
26+
ENV HOSTNAME=bcc-tools
27+
28+
# Running bash
29+
CMD ["bash"]

0 commit comments

Comments
 (0)