-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathDockerfile
57 lines (45 loc) · 1.17 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
FROM golang:1.23.2-bookworm AS builder
ARG VERSION
LABEL version=$VERSION
ENV EBPF_VERSION=$VERSION
WORKDIR /app
ENV GOSUMDB=off \
GOINSECURE=* \
GOPRIVATE=* \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
RUN apt-get update && apt-get install -y \
llvm \
clang \
libbpf-dev \
build-essential \
linux-headers-generic \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash \
&& . $HOME/.nvm/nvm.sh \
&& nvm install v23.1.0 \
&& nvm use v23.1.0
RUN ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm
COPY . .
RUN . $HOME/.nvm/nvm.sh \
&& mkdir -p /app/web \
&& cd web \
&& rm -rf node_modules package-lock.json \
&& npm install \
&& npm run build
RUN cd internal/ebpf \
&& go generate \
&& cd ../.. \
&& go build -o ebpf-firewall \
-ldflags="-s -w" \
-trimpath
FROM debian:bookworm-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/ebpf-firewall .
ENTRYPOINT ["/app/ebpf-firewall"]