-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile.downstream
More file actions
70 lines (53 loc) · 2.4 KB
/
Dockerfile.downstream
File metadata and controls
70 lines (53 loc) · 2.4 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
# We do not use --platform feature to auto fill this ARG because of incompatibility between podman and docker
ARG TARGETARCH
ARG COMMIT
# Make kubectl & oc scripts available for copy
FROM registry.redhat.io/openshift4/ose-cli-rhel9:v4.18.0-202502040032.p0.ga50d4c0.assembly.stream.el9 as ose-cli
# Build the manager binary
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.23 as builder
ARG TARGETARCH=amd64
ARG COMMIT
ARG BUILDVERSION="1.8.0"
ARG IMAGE=registry.redhat.io/network-observability/network-observability-cli-rhel9:1.8
ARG AGENT_IMAGE=registry.redhat.io/network-observability/network-observability-ebpf-agent-rhel9:1.8
WORKDIR /opt/app-root
COPY cmd cmd
COPY main.go main.go
COPY go.mod go.mod
COPY go.sum go.sum
COPY vendor/ vendor/
# Build collector
ENV GOEXPERIMENT strictfipsruntime
RUN GOARCH=$TARGETARCH go build -tags strictfipsruntime -ldflags "-X 'main.buildVersion=${BUILDVERSION}' -X 'main.buildDate=`date +%Y-%m-%d\ %H:%M`'" -mod vendor -a -o build/network-observability-cli
# We still need Makefile & resources for oc-commands; copy them after go build for caching
COPY commands/ commands/
COPY res/ res/
COPY scripts/ scripts/
COPY Makefile Makefile
COPY .mk/ .mk/
# Embed commands in case users want to pull it from collector image
RUN USER=netobserv VERSION="$BUILDVERSION" IMAGE="$IMAGE" AGENT_IMAGE="$AGENT_IMAGE" make oc-commands
# Prepare output dir
RUN mkdir -p output
# Create final image from ubi + built binary and command
FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi:9.5-1741850090
ARG COMMIT
ARG BUILDVERSION="1.8.0"
WORKDIR /
COPY --from=builder /opt/app-root/build .
COPY --from=builder --chown=65532:65532 /opt/app-root/output /output
COPY --from=ose-cli /usr/bin/kubectl /usr/bin/kubectl
COPY --from=ose-cli /usr/bin/oc /usr/bin/oc
USER 65532:65532
ENTRYPOINT ["/network-observability-cli"]
LABEL com.redhat.component="network-observability-cli-container"
LABEL name="network-observability-cli"
LABEL io.k8s.display-name="Network Observability CLI"
LABEL io.k8s.description="Network Observability CLI"
LABEL summary="Network Observability CLI"
LABEL maintainer="support@redhat.com"
LABEL io.openshift.tags="network-observability-cli"
LABEL upstream-vcs-type="git"
LABEL upstream-vcs-ref=$COMMIT
LABEL description="Network Observability CLI is a lightweight Flow, Packet and Metrics visualization tool for on-demand monitoring."
LABEL version=$BUILDVERSION