add distroless otel init (#10035)

add distroless otel init
This commit is contained in:
Ehsan Saei 2023-06-12 12:47:48 +02:00 committed by GitHub
parent 60bf6ba642
commit 436df32c2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 131 additions and 27 deletions

View file

@ -21,9 +21,11 @@ COPY . /opt/third_party/
# install build tools
RUN apk update \
&& apk upgrade \
&& apk add -U bash cmake \
&& apk add -U bash cmake ninja \
&& bash /opt/third_party/build.sh -p
ENV NINJA_STATUS "[%p/%f/%t]"
# install gRPC
FROM base as grpc
RUN bash /opt/third_party/build.sh -g v1.49.2
@ -39,7 +41,17 @@ COPY --from=grpc /opt/third_party/install/ /usr
COPY --from=otel-cpp /opt/third_party/install/ /usr
RUN bash /opt/third_party/build.sh -n
FROM alpine:3.18.0 as final
COPY --from=base /opt/third_party/init_module.sh /usr/local/bin/init_module.sh
FROM cgr.dev/chainguard/go:latest as build-init
WORKDIR /go/src/app
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 go build -o /go/bin/init_module
FROM cgr.dev/chainguard/static as final
COPY --from=build-init /go/bin/init_module /
COPY --from=nginx /etc/nginx/modules /etc/nginx/modules
COPY --from=nginx /opt/third_party/install/lib /etc/nginx/modules
CMD ["/init_module"]