Skip to content

Commit df46cad

Browse files
andrewschoenbigjust
authored andcommitted
Dockerfile: use snmp_notifier from the submodule
Signed-off-by: Andrew Schoen <[email protected]>
1 parent b3508ec commit df46cad

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@
33
#FROM openshift/golang-builder:rhel_9_golang_1.23 AS builder
44
FROM 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

1010
RUN 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-
1625
FROM 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

2231
ENV 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

2736
LABEL maintainer="Guillaume Abrioux <[email protected]>"
2837
LABEL com.redhat.component="snmp-notifier-container"

0 commit comments

Comments
 (0)