-
Notifications
You must be signed in to change notification settings - Fork 108
/
generator.Dockerfile
51 lines (34 loc) · 1.11 KB
/
generator.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
FROM ubuntu:oracular AS base
ARG GOVERSION="1.23.3"
ARG TARGETARCH
RUN echo "using TARGETARCH: $TARGETARCH"
# Installs dependencies that are required to compile eBPF programs
RUN apt update -y
RUN apt install -y curl git linux-headers-generic make llvm clang unzip libbpf-dev libbpf-tools linux-libc-dev linux-bpf-dev
RUN apt clean
VOLUME ["/src"]
WORKDIR /
# Installs a fairly modern distribution of Go
RUN curl -qL https://go.dev/dl/go$GOVERSION.linux-$TARGETARCH.tar.gz -o go.tar.gz
RUN tar -xzf go.tar.gz
RUN rm go.tar.gz
ENV GOROOT /go
RUN mkdir -p /gopath
ENV GOPATH /gopath
ENV GOBIN $GOPATH/bin
ENV PATH $GOROOT/bin:$GOBIN:$PATH
ENV TOOLS_DIR $GOBIN
WORKDIR /tmp
# Copies some pre-required Go dependencies to avoid downloading them on each build
COPY Makefile Makefile
COPY go.mod go.mod
RUN make bpf2go
WORKDIR /src
# fix some arch-dependant missing include files
FROM base AS base-arm64
ENV C_INCLUDE_PATH=/usr/include/aarch64-linux-gnu
FROM base AS base-amd64
ENV C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
# Picks up the arch-specific base
FROM base-$TARGETARCH AS builder
ENTRYPOINT ["make", "generate"]