mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-15 15:15:31 +00:00
Add eBPF dependencies to builder-from-amd64-to-arm64v8
and builder-native-base
This commit is contained in:
parent
9f8e9cc91f
commit
aa3ee5def3
21
Dockerfile
21
Dockerfile
@ -25,7 +25,18 @@ RUN npm run build
|
|||||||
### Base builder image for native builds architecture
|
### Base builder image for native builds architecture
|
||||||
FROM golang:1.17-alpine AS builder-native-base
|
FROM golang:1.17-alpine AS builder-native-base
|
||||||
ENV CGO_ENABLED=1 GOOS=linux
|
ENV CGO_ENABLED=1 GOOS=linux
|
||||||
RUN apk add --no-cache libpcap-dev g++ perl-utils curl build-base binutils-gold bash
|
RUN apk add --no-cache \
|
||||||
|
libpcap-dev \
|
||||||
|
g++ \
|
||||||
|
perl-utils \
|
||||||
|
curl \
|
||||||
|
build-base \
|
||||||
|
binutils-gold \
|
||||||
|
bash \
|
||||||
|
clang \
|
||||||
|
llvm \
|
||||||
|
libbpf-dev \
|
||||||
|
linux-headers
|
||||||
COPY devops/install-capstone.sh .
|
COPY devops/install-capstone.sh .
|
||||||
RUN ./install-capstone.sh
|
RUN ./install-capstone.sh
|
||||||
|
|
||||||
@ -33,23 +44,27 @@ RUN ./install-capstone.sh
|
|||||||
### Intermediate builder image for x86-64 to x86-64 native builds
|
### Intermediate builder image for x86-64 to x86-64 native builds
|
||||||
FROM builder-native-base AS builder-from-amd64-to-amd64
|
FROM builder-native-base AS builder-from-amd64-to-amd64
|
||||||
ENV GOARCH=amd64
|
ENV GOARCH=amd64
|
||||||
|
ENV BPF_CFLAGS="-O2 -g -D__TARGET_ARCH_x86"
|
||||||
|
|
||||||
|
|
||||||
### Intermediate builder image for AArch64 to AArch64 native builds
|
### Intermediate builder image for AArch64 to AArch64 native builds
|
||||||
FROM builder-native-base AS builder-from-arm64v8-to-arm64v8
|
FROM builder-native-base AS builder-from-arm64v8-to-arm64v8
|
||||||
ENV GOARCH=arm64
|
ENV GOARCH=arm64
|
||||||
|
ENV BPF_CFLAGS="-O2 -g -D__TARGET_ARCH_arm64"
|
||||||
|
|
||||||
|
|
||||||
### Builder image for x86-64 to AArch64 cross-compilation
|
### Builder image for x86-64 to AArch64 cross-compilation
|
||||||
FROM up9inc/linux-arm64-musl-go-libpcap-capstone AS builder-from-amd64-to-arm64v8
|
FROM up9inc/linux-arm64-musl-go-libpcap-capstone-bpf AS builder-from-amd64-to-arm64v8
|
||||||
ENV CGO_ENABLED=1 GOOS=linux
|
ENV CGO_ENABLED=1 GOOS=linux
|
||||||
ENV GOARCH=arm64 CGO_CFLAGS="-I/work/libpcap -I/work/capstone/include"
|
ENV GOARCH=arm64 CGO_CFLAGS="-I/work/libpcap -I/work/capstone/include"
|
||||||
|
ENV BPF_CFLAGS="-O2 -g -D__TARGET_ARCH_arm64 -I/usr/xcc/aarch64-linux-musl-cross/aarch64-linux-musl/include/"
|
||||||
|
|
||||||
|
|
||||||
### Builder image for AArch64 to x86-64 cross-compilation
|
### Builder image for AArch64 to x86-64 cross-compilation
|
||||||
FROM up9inc/linux-x86_64-musl-go-libpcap-capstone AS builder-from-arm64v8-to-amd64
|
FROM up9inc/linux-x86_64-musl-go-libpcap-capstone AS builder-from-arm64v8-to-amd64
|
||||||
ENV CGO_ENABLED=1 GOOS=linux
|
ENV CGO_ENABLED=1 GOOS=linux
|
||||||
ENV GOARCH=amd64 CGO_CFLAGS="-I/libpcap -I/capstone/include"
|
ENV GOARCH=amd64 CGO_CFLAGS="-I/libpcap -I/capstone/include"
|
||||||
|
ENV BPF_CFLAGS="-O2 -g -D__TARGET_ARCH_x86"
|
||||||
|
|
||||||
|
|
||||||
### Final builder image where the build happens
|
### Final builder image where the build happens
|
||||||
@ -90,6 +105,8 @@ ARG VER=0.0
|
|||||||
|
|
||||||
WORKDIR /app/agent-build
|
WORKDIR /app/agent-build
|
||||||
|
|
||||||
|
RUN GOARCH=${BUILDARCH} go generate ../tap/tlstapper/tls_tapper.go
|
||||||
|
|
||||||
RUN go build -ldflags="-extldflags=-static -s -w \
|
RUN go build -ldflags="-extldflags=-static -s -w \
|
||||||
-X 'github.com/up9inc/mizu/agent/pkg/version.GitCommitHash=${COMMIT_HASH}' \
|
-X 'github.com/up9inc/mizu/agent/pkg/version.GitCommitHash=${COMMIT_HASH}' \
|
||||||
-X 'github.com/up9inc/mizu/agent/pkg/version.Branch=${GIT_BRANCH}' \
|
-X 'github.com/up9inc/mizu/agent/pkg/version.Branch=${GIT_BRANCH}' \
|
||||||
|
@ -25,3 +25,6 @@ RUN curl https://github.com/capstone-engine/capstone/archive/4.0.2.tar.gz -Lo ./
|
|||||||
WORKDIR /work/capstone
|
WORKDIR /work/capstone
|
||||||
RUN CAPSTONE_ARCHS="aarch64" CAPSTONE_STATIC=yes ./make.sh \
|
RUN CAPSTONE_ARCHS="aarch64" CAPSTONE_STATIC=yes ./make.sh \
|
||||||
&& cp /work/capstone/libcapstone.a /usr/xcc/aarch64-linux-musl-cross/lib/gcc/aarch64-linux-musl/*/
|
&& cp /work/capstone/libcapstone.a /usr/xcc/aarch64-linux-musl-cross/lib/gcc/aarch64-linux-musl/*/
|
||||||
|
|
||||||
|
# Install eBPF related dependencies
|
||||||
|
RUN apt-get -y install clang llvm libbpf-dev
|
4
devops/linux-arm64-musl-go-libpcap-capstone-bpf/build-push.sh
Executable file
4
devops/linux-arm64-musl-go-libpcap-capstone-bpf/build-push.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
docker build . -t up9inc/linux-arm64-musl-go-libpcap-capstone-bpf && docker push up9inc/linux-arm64-musl-go-libpcap-capstone-bpf
|
@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
docker build . -t up9inc/linux-arm64-musl-go-libpcap-capstone && docker push up9inc/linux-arm64-musl-go-libpcap-capstone
|
|
Loading…
Reference in New Issue
Block a user