forked from Dynatrace/dynatrace-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
71 lines (51 loc) · 2.75 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM golang:1.19.4-alpine AS operator-build
RUN apk update --no-cache && \
apk add --no-cache gcc musl-dev btrfs-progs-dev lvm2-dev device-mapper-static gpgme-dev git && \
rm -rf /var/cache/apk/*
ARG GO_LINKER_ARGS
COPY . /app
WORKDIR /app
# move previously cached go modules to gopath
RUN if [ -d ./mod ]; then mkdir -p ${GOPATH}/pkg && [ -d mod ] && mv ./mod ${GOPATH}/pkg; fi;
RUN CGO_ENABLED=1 CGO_CFLAGS="-O2 -Wno-return-local-addr" go build -ldflags="${GO_LINKER_ARGS}" -o ./build/_output/bin/dynatrace-operator ./src/cmd/
FROM registry.access.redhat.com/ubi9-minimal:9.1.0 as dependency-src
RUN microdnf install util-linux tar --nodocs -y && microdnf clean all
FROM registry.access.redhat.com/ubi9-micro:9.1.0
# operator dependencies
COPY --from=operator-build /etc/ssl/cert.pem /etc/ssl/cert.pem
COPY --from=operator-build /app/build/_output/bin /usr/local/bin
COPY --from=operator-build /lib/libc.musl-*.so.* /lib/
COPY --from=operator-build /lib/ld-musl-*.so.* /lib/
COPY --from=operator-build /lib/libdevmapper.so.* /lib/
COPY --from=operator-build /usr/lib/libassuan.so.* /usr/lib/
COPY --from=operator-build /usr/lib/libgpg-error.so.* /usr/lib/
COPY --from=operator-build /usr/lib/libgpgme.so.* /usr/lib/
# csi binaries
COPY --from=registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.7.0 /csi-node-driver-registrar /usr/local/bin
COPY --from=registry.k8s.io/sig-storage/livenessprobe:v2.9.0 /livenessprobe /usr/local/bin
# csi depdenencies
COPY --from=dependency-src /bin/mount /bin/umount /bin/tar /bin/
COPY --from=dependency-src /lib64/libmount.so.1 /lib64/libblkid.so.1 /lib64/libuuid.so.1 /lib64/
COPY ./third_party_licenses /usr/share/dynatrace-operator/third_party_licenses
LABEL name="Dynatrace Operator" \
vendor="Dynatrace LLC" \
maintainer="Dynatrace LLC" \
version="1.x" \
release="1" \
url="https://www.dynatrace.com" \
summary="Dynatrace is an all-in-one, zero-config monitoring platform designed by and for cloud natives. It is powered by artificial intelligence that identifies performance problems and pinpoints their root causes in seconds." \
description="ActiveGate works as a proxy between Dynatrace OneAgent and Dynatrace Cluster" \
io.k8s.description="Dynatrace Operator image." \
io.k8s.display-name="Dynatrace Operator" \
io.openshift.tags="dynatrace-operator" \
vcs-url="https://github.com/Dynatrace/dynatrace-operator.git" \
vcs-type="git" \
changelog-url="https://github.com/Dynatrace/dynatrace-operator/releases"
ENV OPERATOR=dynatrace-operator \
USER_UID=1001 \
USER_NAME=dynatrace-operator
COPY LICENSE /licenses/
COPY hack/build/bin /usr/local/bin
RUN /usr/local/bin/user_setup
ENTRYPOINT ["/usr/local/bin/entrypoint"]
USER ${USER_UID}:${USER_UID}