3
3
# FROM openshift/golang-builder:rhel_9_golang_1.23 AS builder
4
4
FROM quay.io/projectquay/golang:1.23 AS builder
5
5
6
- COPY $REMOTE_SOURCE $REMOTE_SOURCE_DIR
6
+ COPY snmp_notifier snmp_notifier
7
7
8
- WORKDIR $REMOTE_SOURCE_DIR/app
8
+ WORKDIR snmp_notifier
9
9
10
10
RUN dnf install -y glibc-static
11
11
12
- RUN source $CACHITO_ENV_FILE && go build -mod=readonly -o $REMOTE_SOURCE_DIR/app/bin/snmp_notifier -ldflags "-s -X github.com/prometheus/common/version.Version=1.2.1 -X github.com/prometheus/common/version.Revision=14ba67401c61cfc2f19ebd9ace8acdcf47b4cd49 -X github.com/prometheus/common/version.Branch=master -X github.com/prometheus/common/version.BuildUser=osbs -X github.com/prometheus/common/version.BuildDate=20211104-18:55:37 -extldflags '-static'" -a -tags netgo ${REMOTE_SOURCE_DIR}/app/snmp_notifier.go
12
+ # Build the binary
13
+ RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -mod=readonly \
14
+ -o snmp_notifier \
15
+ -ldflags "-s \
16
+ -X github.com/prometheus/common/version.Version=1.2.1 \
17
+ -X github.com/prometheus/common/version.Revision=14ba67401c61cfc2f19ebd9ace8acdcf47b4cd49 \
18
+ -X github.com/prometheus/common/version.Branch=master \
19
+ -X github.com/prometheus/common/version.BuildUser=osbs \
20
+ -X github.com/prometheus/common/version.BuildDate=20211104-18:55:37 \
21
+ -extldflags '-static'" \
22
+ -a -tags netgo
13
23
14
24
# Build stage 2
15
-
16
25
FROM registry.redhat.io/ubi9/ubi-minimal
17
26
18
27
# Update the image to get the latest CVE updates
@@ -21,8 +30,8 @@ RUN microdnf update -y && \
21
30
22
31
ENV OPBIN=/usr/local/bin/snmp_notifier
23
32
24
- COPY --from=builder $REMOTE_SOURCE_DIR/app/bin /snmp_notifier "$OPBIN"
25
- COPY --from=builder $REMOTE_SOURCE_DIR/app /description-template.tpl /etc/snmp_notifier/description-template.tpl
33
+ COPY --from=builder /go/snmp_notifier /snmp_notifier "$OPBIN"
34
+ COPY --from=builder /go/snmp_notifier /description-template.tpl /etc/snmp_notifier/description-template.tpl
26
35
27
36
LABEL maintainer=
"Guillaume Abrioux <[email protected] >"
28
37
LABEL com.redhat.component="snmp-notifier-container"
0 commit comments