forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Containerfile.operator
110 lines (91 loc) · 3.41 KB
/
Containerfile.operator
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Golang build container
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.22 AS builder
WORKDIR $GOPATH/src/github.com/grafana/grafana
ARG COMMIT_SHA="5b85c4c2fcf5d32d4f68aaef345c53096359b2f1"
ARG BUILD_BRANCH=""
ARG GO_BUILD_TAGS="oss"
ARG WIRE_TAGS="oss"
ARG BINGO="true"
COPY go.mod go.sum embed.go Makefile build.go package.json ./
COPY kinds kinds
COPY local local
COPY packages/grafana-schema packages/grafana-schema/
COPY public/app/plugins public/app/plugins/
COPY public/api-merged.json public/api-merged.json
COPY plugins-bundled plugins-bundled
COPY pkg pkg/
COPY scripts scripts/
COPY cue.mod cue.mod/
COPY .bingo .bingo
COPY conf conf
COPY go.* ./
# Apply custom patches
COPY stolostron-patches stolostron-patches
RUN git apply ./stolostron-patches/*
RUN go work vendor
RUN go run build.go -build-tags=strictfipsruntime build
# Need to copy the generated binaries to a non-platform specific location to handle
# s390x builds for example
RUN cp $GOPATH/src/github.com/grafana/grafana/bin/linux-$(go env GOARCH)/grafana* /usr/bin/
# Final container
FROM registry.access.redhat.com/ubi9/ubi:latest
ARG VCS_REF
ARG VCS_URL
ARG IMAGE_NAME
ARG IMAGE_DESCRIPTION
ARG IMAGE_DISPLAY_NAME
ARG IMAGE_NAME_ARCH
ARG IMAGE_MAINTAINER
ARG IMAGE_VENDOR
ARG IMAGE_VERSION
ARG IMAGE_RELEASE
ARG IMAGE_SUMMARY
ARG IMAGE_OPENSHIFT_TAGS
LABEL org.label-schema.vendor="Red Hat" \
org.label-schema.name="$IMAGE_NAME_ARCH" \
org.label-schema.description="$IMAGE_DESCRIPTION" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.license="Red Hat Advanced Cluster Management for Kubernetes EULA" \
org.label-schema.schema-version="1.0" \
name="$IMAGE_NAME" \
maintainer="$IMAGE_MAINTAINER" \
vendor="$IMAGE_VENDOR" \
version="$IMAGE_VERSION" \
release="$IMAGE_RELEASE" \
description="$IMAGE_DESCRIPTION" \
summary="$IMAGE_SUMMARY" \
io.k8s.display-name="$IMAGE_DISPLAY_NAME" \
io.k8s.description="$IMAGE_DESCRIPTION" \
io.openshift.tags="$IMAGE_OPENSHIFT_TAGS"
ARG GF_UID="472"
ARG GF_GID="472"
ENV PATH=/usr/share/grafana/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
GF_PATHS_CONFIG="/etc/grafana/grafana.ini" \
GF_PATHS_DATA="/var/lib/grafana" \
GF_PATHS_HOME="/usr/share/grafana" \
GF_PATHS_LOGS="/var/log/grafana" \
GF_PATHS_PLUGINS="/var/lib/grafana/plugins" \
GF_PATHS_PROVISIONING="/etc/grafana/provisioning"
WORKDIR $GF_PATHS_HOME
COPY conf ./conf
RUN mkdir -p "$GF_PATHS_HOME/.aws" && \
groupadd --system -g $GF_GID grafana && \
useradd --system -u $GF_UID -g grafana grafana && \
mkdir -p "$GF_PATHS_PROVISIONING/datasources" \
"$GF_PATHS_PROVISIONING/dashboards" \
"$GF_PATHS_PROVISIONING/notifiers" \
"$GF_PATHS_LOGS" \
"$GF_PATHS_PLUGINS" \
"$GF_PATHS_DATA" && \
cp "$GF_PATHS_HOME/conf/sample.ini" "$GF_PATHS_CONFIG" && \
cp "$GF_PATHS_HOME/conf/ldap.toml" /etc/grafana/ldap.toml && \
chown -R grafana:grafana "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" "$GF_PATHS_PROVISIONING" && \
chmod -R 777 "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" "$GF_PATHS_PROVISIONING"
COPY --from=builder /usr/bin/grafana* ./bin/
COPY public ./public
COPY tools ./tools
EXPOSE 3000
COPY ./packaging/docker/run.sh /run.sh
USER grafana
ENTRYPOINT [ "/run.sh" ]