forked from open-telemetry/opentelemetry-ebpf-profiler
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
49 lines (40 loc) · 2.19 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
FROM debian:testing
WORKDIR /agent
# cross_debian_arch: amd64 or arm64
# cross_pkg_arch: x86-64 or aarch64
RUN cross_debian_arch=$(uname -m | sed -e 's/aarch64/amd64/' -e 's/x86_64/arm64/'); \
cross_pkg_arch=$(uname -m | sed -e 's/aarch64/x86-64/' -e 's/x86_64/aarch64/'); \
apt-get update -y && \
apt-get dist-upgrade -y && \
apt-get install -y wget make git clang-16 unzip libc6-dev g++ gcc pkgconf \
gcc-${cross_pkg_arch}-linux-gnu libc6-${cross_debian_arch}-cross && \
apt-get clean autoclean && \
apt-get autoremove --yes
COPY go.mod /tmp/go.mod
# Extract Go version from go.mod
RUN GO_VERSION=$(grep -oPm1 '^go \K([[:digit:].]+)' /tmp/go.mod) && \
wget -qO- https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz
# Set Go environment variables
ENV GOPATH="/agent/go"
ENV GOCACHE="/agent/.cache"
ENV PATH="/usr/local/go/bin:$PATH"
RUN wget -qO- https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s -- -b $(go env GOPATH)/bin v1.56.2
# gRPC dependencies
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
RUN \
PB_URL="https://github.com/protocolbuffers/protobuf/releases/download/v24.4/"; \
PB_FILE="protoc-24.4-linux-x86_64.zip"; \
INSTALL_DIR="/usr/local"; \
\
wget -q "$PB_URL/$PB_FILE" \
&& unzip "$PB_FILE" -d "$INSTALL_DIR" 'bin/*' 'include/*' \
&& chmod +xr "$INSTALL_DIR/bin/protoc" \
&& find "$INSTALL_DIR/include" -type d -exec chmod +x {} \; \
&& find "$INSTALL_DIR/include" -type f -exec chmod +r {} \; \
&& rm "$PB_FILE"
# Append to /etc/profile for login shells
RUN echo 'export PATH="/usr/local/go/bin:$PATH"' >> /etc/profile
RUN apt-get install -y libbpf-dev
ENTRYPOINT ["/bin/bash", "-l", "-c"]