forked from merbridge/merbridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (26 loc) · 980 Bytes
/
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
FROM ubuntu:20.04 as compiler
WORKDIR /app
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update &&\
apt-get install -y git cmake make gcc python3 libncurses-dev gawk flex bison openssl \
libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf
RUN git clone -b v5.4 https://github.com/torvalds/linux.git --depth 1
RUN cd /app/linux/tools/bpf/bpftool && \
make && make install
FROM golang:1.18.4 as mbctl
WORKDIR /app
ADD go.mod .
ADD go.sum .
RUN go mod download
ADD . .
RUN go build -ldflags "-s -w" -o ./dist/mbctl ./app/main.go
RUN go build -ldflags "-s -w" -o ./dist/merbridge-cni ./app/cni/main.go
FROM ubuntu:20.04
WORKDIR /app
RUN apt-get update && apt-get install -y libelf-dev make sudo clang iproute2 ethtool
COPY --from=compiler /usr/local/sbin/bpftool /usr/local/sbin/bpftool
COPY bpf bpf
COPY Makefile Makefile
COPY --from=mbctl /app/dist/mbctl mbctl
COPY --from=mbctl /app/dist/merbridge-cni merbridge-cni
CMD /app/mbctl