-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile.prometheus
More file actions
60 lines (45 loc) · 2.19 KB
/
Dockerfile.prometheus
File metadata and controls
60 lines (45 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
FROM registry.redhat.io/ubi9/nodejs-22:latest AS web-builder
USER 0
WORKDIR /workspace
COPY prometheus/ .
RUN make assets-compress
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.24 AS builder
WORKDIR /workspace
# RUN microdnf install -y bzip2 jq && microdnf clean all
COPY --from=web-builder /workspace/ .
ENV GOFLAGS='-mod=mod -tags=builtinassets,netgo,stringlabels'
ENV CGO_ENABLED=0
# Build prometheus directly using Go
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build $GOFLAGS -o ./prometheus ./cmd/prometheus
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build $GOFLAGS -o ./promtool ./cmd/promtool
FROM registry.redhat.io/ubi9/ubi-minimal:latest@sha256:c7d44146f826037f6873d99da479299b889473492d3c1ab8af86f08af04ec8a0
COPY --from=builder /workspace/prometheus /bin/prometheus
COPY --from=builder /workspace/promtool /bin/promtool
COPY --from=builder /workspace/documentation/examples/prometheus.yml /etc/prometheus/prometheus.yml
COPY --from=builder /workspace/LICENSE /licenses/.
RUN mkdir -p /prometheus \
&& chgrp -R 0 /etc/prometheus /prometheus \
&& chmod -R g=u /etc/prometheus /prometheus
USER nobody
EXPOSE 9090
WORKDIR /prometheus
VOLUME ["/prometheus"]
ENTRYPOINT ["/bin/prometheus"]
CMD [ "--config.file=/etc/prometheus/prometheus.yml", \
"--storage.tsdb.path=/prometheus" ]
ARG VERSION=v3.9.1
LABEL com.redhat.component="coo-prometheus-container" \
name="cluster-observability-operator/prometheus-rhel9" \
cpe="cpe:/a:redhat:cluster_observability_operator:1.4::el9" \
version="${VERSION}" \
release="${VERSION}" \
vendor="Red Hat, Inc." \
distribution-scope="public" \
url="https://github.com/prometheus/prometheus" \
summary="Prometheus for Cluster Observability Operator" \
io.openshift.expose-services="" \
io.openshift.tags="monitoring" \
io.k8s.display-name="COO Prometheus" \
io.k8s.description="Prometheus is a CNCF project that collects metrics, evaluates rules and triggers alerts." \
maintainer="team-monitoring@redhat.com" \
description="Prometheus for Cluster Observability Operator"