Skip to content

Commit b336646

Browse files
Sachin-YeshwanthRakshitha-Kamath
authored andcommitted
Added new Dockerfile to support IBM deployment
1 parent 14cb30e commit b336646

File tree

7 files changed

+5996
-976
lines changed

7 files changed

+5996
-976
lines changed

.tekton/snmp-notifier-pull-request.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ spec:
3434
value: Dockerfile
3535
- name: path-context
3636
value: .
37+
- name: ACTIVATION_KEY
38+
value: rkamath-activation-key
3739
pipelineSpec:
3840
description: |
3941
This pipeline is ideal for building multi-arch container images from a Containerfile while maintaining trust after pipeline customization.

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ COPY snmp_notifier snmp_notifier
55

66
WORKDIR snmp_notifier
77

8-
#RUN dnf upgrade -y && dnf install -y \
9-
# glibc-static \
10-
# && dnf clean all && rm -rf /var/cache/yum
8+
RUN dnf install -y glibc-static
119

12-
RUN dnf remove -y glibc-langpack-en && dnf install -y glibc glibc-devel glibc-static
10+
#RUN dnf remove -y glibc-langpack-en && dnf install -y glibc glibc-devel glibc-static
1311

1412
# Build the binary
1513
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -mod=readonly \
@@ -24,7 +22,7 @@ RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -mod=readonly \
2422
-a -tags netgo
2523

2624
# Build stage 2
27-
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi10-minimal:latest
25+
FROM --platform=$BUILDPLATFORM registry.redhat.io/ubi10-minimal:latest
2826

2927
# Update the image to get the latest CVE updates
3028
RUN microdnf update -y && \

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/ubi10-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:9::el10
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)