33# FROM openshift/golang-builder:rhel_9_golang_1.23 AS builder
44FROM quay.io/projectquay/golang:1.23 AS builder
55
6- COPY $REMOTE_SOURCE $REMOTE_SOURCE_DIR
6+ COPY snmp_notifier snmp_notifier
77
8- WORKDIR $REMOTE_SOURCE_DIR/app
8+ WORKDIR snmp_notifier
99
1010RUN dnf install -y glibc-static
1111
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
1323
1424# Build stage 2
15-
1625FROM registry.redhat.io/ubi9/ubi-minimal
1726
1827# Update the image to get the latest CVE updates
@@ -21,8 +30,8 @@ RUN microdnf update -y && \
2130
2231ENV OPBIN=/usr/local/bin/snmp_notifier
2332
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
2635
2736LABEL maintainer="Guillaume Abrioux <gabrioux@redhat.com>"
2837LABEL com.redhat.component="snmp-notifier-container"
0 commit comments