From 3009afc29270e4892b7c87fc1bc5436476a1215b Mon Sep 17 00:00:00 2001 From: zhouchaowen <2575557160@qq.com> Date: Thu, 14 Sep 2023 22:49:19 +0800 Subject: [PATCH] update build bpf image --- Dockerfile | 13 +++---------- Makefile | 7 +++++-- README.md | 2 +- parse_http.go | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4c824d4..db15037 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,8 @@ -FROM ebpf-build:v22.04-llvm-14 as builder +FROM ghcr.io/cilium/ebpf-builder:1694533004 as builder WORKDIR /prism COPY . . -RUN make gen - -FROM golang:1.18.6 as compiler -WORKDIR /app -COPY --from=builder /prism . - -RUN go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn,direct && go mod tidy -RUN go build -ldflags "-s -w" -o prism . +RUN make build FROM ubuntu:22.04 ARG DIR_NAME @@ -17,5 +10,5 @@ WORKDIR / RUN mkdir web COPY --from=builder /prism/web /web -COPY --from=compiler /app/prism . +COPY --from=builder /prism/prism . RUN chmod +x prism \ No newline at end of file diff --git a/Makefile b/Makefile index 99687e9..8f9f70b 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ IMAGE ?= $(NAME):$(VERSION) format: find . -type f -name "*.c" | xargs clang-format -i +env: + go env -w GOPROXY=https://goproxy.cn,direct && go install github.com/cilium/ebpf/cmd/bpf2go@latest + # $BPF_CLANG is used in go:generate invocations. gen: export BPF_CLANG := $(CLANG) gen: export BPF_CFLAGS := $(CFLAGS) @@ -28,8 +31,8 @@ ps: pl: scp -r root@10.2.0.105:/root/prism/* . -build: - make gen && export GO111MODULE=on && go build -ldflags "-s -w" -o prism . +build: env gen + go mod tidy && go build -ldflags "-s -w" -o prism . run: build ./prism -n $(DEV) diff --git a/README.md b/README.md index 3d19231..6c02cfb 100644 --- a/README.md +++ b/README.md @@ -48,5 +48,5 @@ make build compile by docker ```bash -docker run --rm -v /root/prism:/root/prism ebpf-build:v22.04-llvm-14 bash -c "cd /root/prism && make build" +docker run --rm -v /root/prism:/root/prism ghcr.io/cilium/ebpf-builder:1694533004 bash -c "cd /root/prism && make build" ``` diff --git a/parse_http.go b/parse_http.go index d7798d5..f5ba4ae 100644 --- a/parse_http.go +++ b/parse_http.go @@ -30,7 +30,7 @@ const ( func ParseHttp(data []byte) error { if Debug && Verbose { - log.Printf("data:%+v", data) + log.Printf("[PACKAGE] data:%+v", data) } flyHttp, err := extractFlyHttp(data)