FROM openshift/golang-builder@sha256:21aab8ec0f5d119e4f6dab12f7ad6a1cec15d5f9071ae0c7431be760f29d4c71 AS builder
ENV __doozer=update BUILD_RELEASE=202203091310.p0.g3197fa7.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202203091310.p0.g3197fa7.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=3197fa7 OS_GIT_VERSION=4.9.0-202203091310.p0.g3197fa7.assembly.stream-3197fa7 SOURCE_DATE_EPOCH=1630397817 SOURCE_GIT_COMMIT=3197fa71f6b01d2acd8c354056b015d1c0a06f7d SOURCE_GIT_TAG=golang-github-prometheus-prometheus-4.0.0-0.102.0-3747-g3197fa71f SOURCE_GIT_URL=https://github.com/openshift/prometheus 
WORKDIR /go/src/github.com/prometheus/prometheus
COPY . .
# NOTE(spasquie): the 'build' target regenerates the ReactJS code and the Go
# assets on the fly.  Build environments don't have access to Yarn and external
# package repositories so we use the 'common-build' target instead.
# It means that every time we update to a new Prometheus version, 'make assets'
# should be run locally and the resulting file (web/ui/assets_vfsdata.go)
# should be committed to the repository.
RUN if yum install -y prometheus-promu; then export BUILD_PROMU=false; fi && make common-build

FROM openshift/base-rhel8:v4.9.0-202203081819.p0.gf17f552.assembly.stream
ENV __doozer=update BUILD_RELEASE=202203091310.p0.g3197fa7.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202203091310.p0.g3197fa7.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=3197fa7 OS_GIT_VERSION=4.9.0-202203091310.p0.g3197fa7.assembly.stream-3197fa7 SOURCE_DATE_EPOCH=1630397817 SOURCE_GIT_COMMIT=3197fa71f6b01d2acd8c354056b015d1c0a06f7d SOURCE_GIT_TAG=golang-github-prometheus-prometheus-4.0.0-0.102.0-3747-g3197fa71f SOURCE_GIT_URL=https://github.com/openshift/prometheus 

ARG FROM_DIRECTORY=/go/src/github.com/prometheus/prometheus
COPY --from=builder ${FROM_DIRECTORY}/prometheus                            /bin/prometheus
COPY --from=builder ${FROM_DIRECTORY}/promtool                              /bin/promtool
COPY --from=builder ${FROM_DIRECTORY}/documentation/examples/prometheus.yml /etc/prometheus/prometheus.yml
COPY --from=builder ${FROM_DIRECTORY}/console_libraries/                    /usr/share/prometheus/console_libraries/
COPY --from=builder ${FROM_DIRECTORY}/consoles/                             /usr/share/prometheus/consoles/

RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/
RUN mkdir -p /prometheus && \
    chgrp -R 0 /etc/prometheus /prometheus && \
    chmod -R g=u /etc/prometheus /prometheus

USER       nobody
EXPOSE     9090
WORKDIR    /prometheus
ENTRYPOINT [ "/bin/prometheus" ]
CMD        [ "--config.file=/etc/prometheus/prometheus.yml", \
             "--storage.tsdb.path=/prometheus", \
             "--web.console.libraries=/usr/share/prometheus/console_libraries", \
             "--web.console.templates=/usr/share/prometheus/consoles" ]

LABEL \
        io.k8s.display-name="Prometheus" \
        io.k8s.description="This is the Prometheus base image." \
        io.openshift.tags="openshift,prometheus" \
        summary="The Prometheus monitoring system and time series database." \
        maintainer="OpenShift Monitoring Team <team-monitoring@redhat.com>" \
        License="ASL 2.0" \
        vendor="Red Hat" \
        name="openshift/ose-prometheus" \
        com.redhat.component="golang-github-prometheus-prometheus-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Monitoring" \
        release="202203091310.p0.g3197fa7.assembly.stream" \
        io.openshift.build.commit.id="3197fa71f6b01d2acd8c354056b015d1c0a06f7d" \
        io.openshift.build.source-location="https://github.com/openshift/prometheus" \
        io.openshift.build.commit.url="https://github.com/openshift/prometheus/commit/3197fa71f6b01d2acd8c354056b015d1c0a06f7d" \
        version="v4.9.0"

