Skip to content

Commit 5a3acc3

Browse files
Sachin-Yeshwanthrakshithakamath94
authored andcommitted
Adding a new Dockerfile to support IBM deployment
1 parent 73dd4ce commit 5a3acc3

File tree

2 files changed

+55
-3
lines changed

2 files changed

+55
-3
lines changed

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# This Dockerfile is tailored for Konflux and it runs hermetically.
33

44
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.24 AS builder
5-
#FROM --platform=$BUILDPLATFORM quay.io/projectquay/golang:1.23 AS builder
65

76
COPY snmp_notifier snmp_notifier
87

@@ -26,7 +25,7 @@ RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -mod=readonly \
2625
-a -tags netgo
2726

2827
# Build stage 2
29-
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9-minimal:latest
28+
FROM --platform=$BUILDPLATFORM registry.redhat.io/ubi9-minimal:latest
3029

3130
# Update the image to get the latest CVE updates
3231
RUN microdnf update -y && \
@@ -46,7 +45,7 @@ LABEL summary="Provides snmp_notifier container."
4645
LABEL io.k8s.display-name="SNMP Notifier container"
4746
LABEL io.k8s.description="SNMP Notifier container receives alerts from the Prometheus' Alertmanager and routes them as SNMP traps."
4847
LABEL io.openshift.tags="1.2.1"
49-
LABEL cpe=cpe:/a:redhat:ceph_storage:9::el9
48+
LABEL cpe=cpe:/a:redhat:ceph_storage:8::el9
5049
LABEL org.opencontainers.image.created="${BUILD_DATE}"
5150

5251

Dockerfile_IBM

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Build stage 1
2+
ARG BASE_IMAGE=registry.redhat.io/ubi9/go-toolset:1.24.4
3+
4+
FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS builder
5+
USER root
6+
COPY snmp_notifier snmp_notifier
7+
8+
WORKDIR snmp_notifier
9+
10+
RUN dnf install -y glibc-static
11+
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
23+
24+
# Build stage 2
25+
FROM --platform=$BUILDPLATFORM registry.redhat.io/ubi9-minimal:latest
26+
27+
# Update the image to get the latest CVE updates
28+
RUN microdnf update -y && \
29+
microdnf clean all
30+
31+
ENV OPBIN=/usr/local/bin/snmp_notifier
32+
33+
COPY --from=builder /opt/app-root/src/snmp_notifier/snmp_notifier "$OPBIN"
34+
COPY --from=builder /opt/app-root/src/snmp_notifier/description-template.tpl /etc/snmp_notifier/description-template.tpl
35+
36+
LABEL maintainer="Guillaume Abrioux <[email protected]>"
37+
LABEL com.redhat.component="snmp-notifier-container"
38+
LABEL name="snmp-notifier"
39+
LABEL version="1.2.1"
40+
LABEL description="SNMP Notifier container"
41+
LABEL summary="Provides snmp_notifier container."
42+
LABEL io.k8s.display-name="SNMP Notifier container"
43+
LABEL io.k8s.description="SNMP Notifier container receives alerts from the Prometheus' Alertmanager and routes them as SNMP traps."
44+
LABEL io.openshift.tags="1.2.1"
45+
LABEL cpe=cpe:/a:redhat:ceph_storage:8::el9
46+
LABEL org.opencontainers.image.created="${BUILD_DATE}"
47+
48+
49+
RUN chmod +x "$OPBIN"
50+
51+
EXPOSE 9464
52+
ENTRYPOINT ["/usr/local/bin/snmp_notifier"]
53+
CMD ["--snmp.trap-description-template=/etc/snmp_notifier/description-template.tpl"]

0 commit comments

Comments
 (0)