-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathDockerfile
More file actions
75 lines (54 loc) · 1.81 KB
/
Dockerfile
File metadata and controls
75 lines (54 loc) · 1.81 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Build the autoinstrumenter binary
ARG GEN_IMG=ghcr.io/open-telemetry/obi-generator:latest@sha256:b00857fa2cf0c69a7b4c07a079e84ba8b130d26efe8365cc88eb32ec62ea63f7
FROM $GEN_IMG AS builder
# TODO: embed software version in executable
ARG TARGETARCH
# set it to a non-empty value if you are building this image
# from a custom, local OBI repository
# In that case, you must run `make generate copy-obi-vendor`
# manually, before building this image.
# Or directly run`make dev-image-build`
ARG DEV_OBI
ENV GOARCH=$TARGETARCH
WORKDIR /src
RUN apk add make git bash
# Copy the go manifests and source
COPY .git/ .git/
COPY cmd/ cmd/
COPY pkg/ pkg/
COPY vendor/ vendor/
COPY go.mod go.mod
COPY go.sum go.sum
COPY Makefile Makefile
COPY LICENSE LICENSE
COPY NOTICE NOTICE
COPY third_party_licenses.csv third_party_licenses.csv
# OBI's Makefile doesn't let to override BPF2GO env var: temporary hack until we can
ENV TOOLS_DIR=/go/bin
# Build
RUN if [ -z "${DEV_OBI}" ]; then \
export PATH="/usr/lib/llvm20/bin:$PATH" && \
make generate && \
make copy-obi-vendor \
; fi
RUN make compile
# Build the Java OBI agent
FROM gradle:9.3.1-jdk21-noble@sha256:f3784cc59d7fbab1e0ddb09c4cd082f13e16d3fb8c50b7922b7aeae8e9507da5 AS javaagent-builder
WORKDIR /build
RUN apt update
RUN apt install -y clang llvm
# Copy build files
COPY .obi-src/pkg/internal/java .
# Build the project
RUN ./gradlew build --no-daemon
# Create final image from minimal + built binary
FROM scratch
LABEL maintainer="Grafana Labs <hello@grafana.com>"
WORKDIR /
COPY --from=javaagent-builder /build/build/obi-java-agent.jar .
COPY --from=builder /src/bin/beyla .
COPY --from=builder /src/LICENSE .
COPY --from=builder /src/NOTICE .
COPY --from=builder /src/third_party_licenses.csv .
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
ENTRYPOINT [ "/beyla" ]