-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (26 loc) · 1.38 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
# Need at least glibc, libelf, libz installed to run xdp-loader, bpftool, and other binaries
# Use a slightly older version of fedora so it's linked to an older version of glibc (v2.29)
FROM fedora:32 AS builder
RUN dnf -y update && \
dnf install -y clang llvm gcc elfutils-libelf-devel glibc-devel.i686 m4 libpcap-devel make bison flex && \
dnf install -y findutils vim git
COPY ./ /tmp/xdp
RUN make -C /tmp/xdp/src
FROM golang:alpine as gobuilder
COPY ./src/sockmap_daemon.go $GOPATH/src
RUN cd $GOPATH/src && go mod init sockmap && ls -al /go/src
RUN cd $GOPATH/src && go get github.com/moby/sys/mountinfo
RUN cd $GOPATH/src && go build -o /sockmap_daemon
FROM frolvlad/alpine-glibc:alpine-3.14_glibc-2.33
RUN apk add libelf
RUN mkdir -p /root/bin
COPY --from=builder /tmp/xdp/src/.output/xdp_kern.o /root/bin/
COPY --from=builder /tmp/xdp/src/.output/xdp_stats /root/bin/
COPY --from=builder /tmp/xdp/src/.output/xdp-tools/xdp-loader /root/bin/
COPY --from=builder /tmp/xdp/src/.output/bpftool/bpftool /root/bin/
COPY --from=builder /tmp/xdp/src/.output/tc_kern.o /root/bin/
COPY --from=builder /tmp/xdp/src/.output/tc_stats /root/bin/
COPY --from=builder /tmp/xdp/src/.output/iproute2/tc /root/bin/
COPY --from=builder /tmp/xdp/src/.output/sockmap_redir.o /root/bin/
COPY --from=builder /tmp/xdp/src/.output/sockops.o /root/bin/
COPY --from=gobuilder /sockmap_daemon /root/bin/sockmap_daemon