generated from VolkovLabs/volkovlabs-abc-app
-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Dockerfile
153 lines (124 loc) · 7.06 KB
/
Dockerfile
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
FROM grafana/grafana-oss:11.3.0
##################################################################
## CONFIGURATION
##################################################################
## Set Grafana options
ENV GF_ENABLE_GZIP=true
ENV GF_USERS_DEFAULT_THEME=light
## Enable Anonymous Authentication
ENV GF_AUTH_ANONYMOUS_ENABLED=true
ENV GF_AUTH_BASIC_ENABLED=false
## Disable Sanitize
ENV GF_PANELS_DISABLE_SANITIZE_HTML=true
## Check for Updates
ENV GF_ANALYTICS_CHECK_FOR_UPDATES=false
## Set Home Dashboard
ENV GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards/business.json
## Paths
ENV GF_PATHS_PROVISIONING="/etc/grafana/provisioning"
ENV GF_PATHS_PLUGINS="/var/lib/grafana/plugins"
##################################################################
## Copy Artifacts
## Required for the App plugin
##################################################################
COPY --chown=grafana:root dist /app
COPY entrypoint.sh /
## Copy Provisioning
COPY --chown=grafana:root provisioning $GF_PATHS_PROVISIONING
##################################################################
## Customization depends on the Grafana version
## May work or not work for the version different from the current
## Check GitHub file history for the previous Grafana versions
##################################################################
USER root
##################################################################
## VISUAL
## Update Image files
##################################################################
## Replace Favicon and Apple Touch
COPY img/fav32.png /usr/share/grafana/public/img
COPY img/fav32.png /usr/share/grafana/public/img/apple-touch-icon.png
## Replace Logo
COPY img/logo.svg /usr/share/grafana/public/img/grafana_icon.svg
## Update Background
COPY img/background.svg /usr/share/grafana/public/img/g8_login_dark.svg
COPY img/background.svg /usr/share/grafana/public/img/g8_login_light.svg
##################################################################
## HANDS-ON
## Update HTML, INI files
##################################################################
# Update Title
RUN sed -i 's|<title>\[\[.AppTitle\]\]</title>|<title>Business App</title>|g' /usr/share/grafana/public/views/index.html
RUN sed -i 's|Loading Grafana|Loading Business App|g' /usr/share/grafana/public/views/index.html
## Update Mega and Help menu
RUN sed -i "s|\[\[.NavTree\]\],|nav,|g; \
s|window.grafanaBootData = {| \
let nav = [[.NavTree]]; \
const dashboards = nav.find((element) => element.id === 'dashboards/browse'); \
if (dashboards) { dashboards['children'] = [];} \
const connections = nav.find((element) => element.id === 'connections'); \
if (connections) { connections['url'] = '/datasources'; connections['children'].shift(); } \
const help = nav.find((element) => element.id === 'help'); \
if (help) { help['subTitle'] = 'Business App 4.4.0'; help['children'] = [];} \
window.grafanaBootData = {|g" \
/usr/share/grafana/public/views/index.html
# Move Business App to navigation root section
RUN sed -i 's|\[navigation.app_sections\]|\[navigation.app_sections\]\nbusiness-app=root|g' /usr/share/grafana/conf/defaults.ini
##################################################################
## HANDS-ON
## Update JavaScript files
##################################################################
RUN find /usr/share/grafana/public/build/ -name *.js \
## Update Title
-exec sed -i 's|AppTitle="Grafana"|AppTitle="Business App"|g' {} \; \
## Update Login Title
-exec sed -i 's|LoginTitle="Welcome to Grafana"|LoginTitle="Business App for Grafana"|g' {} \; \
## Remove Documentation, Support, Community in the Footer
-exec sed -i 's|\[{target:"_blank",id:"documentation".*grafana_footer"}\]|\[\]|g' {} \; \
## Remove Edition in the Footer
-exec sed -i 's|({target:"_blank",id:"license",.*licenseUrl})|()|g' {} \; \
## Remove Version in the Footer
-exec sed -i 's|({target:"_blank",id:"version",text:f.versionString,url:D?"https://github.com/grafana/grafana/blob/main/CHANGELOG.md":void 0})|()|g' {} \; \
## Remove News icon
-exec sed -i 's|(.,.....)(....,{className:.,onClick:.,iconOnly:!0,icon:"rss","aria-label":"News"})|null|g' {} \; \
## Remove Open Source icon
-exec sed -i 's|.push({target:"_blank",id:"version",text:`${..edition}${.}`,url:..licenseUrl,icon:"external-link-alt"})||g' {} \;
##################################################################
## CLEANING
## Remove Native Data Sources
##################################################################
RUN rm -rf /usr/share/grafana/public/app/plugins/datasource/elasticsearch /usr/share/grafana/public/build/elasticsearch* \
/usr/share/grafana/public/app/plugins/datasource/graphite /usr/share/grafana/public/build/graphite* \
/usr/share/grafana/public/app/plugins/datasource/opentsdb /usr/share/grafana/public/build/opentsdb* \
/usr/share/grafana/public/app/plugins/datasource/influxdb /usr/share/grafana/public/build/influxdb* \
/usr/share/grafana/public/app/plugins/datasource/mssql /usr/share/grafana/public/build/mssql* \
/usr/share/grafana/public/app/plugins/datasource/mysql /usr/share/grafana/public/build/mysql* \
/usr/share/grafana/public/app/plugins/datasource/tempo /usr/share/grafana/public/build/tempo* \
/usr/share/grafana/public/app/plugins/datasource/jaeger /usr/share/grafana/public/build/jaeger* \
/usr/share/grafana/public/app/plugins/datasource/zipkin /usr/share/grafana/public/build/zipkin* \
/usr/share/grafana/public/app/plugins/datasource/azuremonitor /usr/share/grafana/public/build/azureMonitor* \
/usr/share/grafana/public/app/plugins/datasource/cloudwatch /usr/share/grafana/public/build/cloudwatch* \
/usr/share/grafana/public/app/plugins/datasource/cloud-monitoring /usr/share/grafana/public/build/cloudMonitoring* \
/usr/share/grafana/public/app/plugins/datasource/parca /usr/share/grafana/public/build/parca* \
/usr/share/grafana/public/app/plugins/datasource/phlare /usr/share/grafana/public/build/phlare* \
/usr/share/grafana/public/app/plugins/datasource/grafana-pyroscope-datasource /usr/share/grafana/public/build/pyroscope*
## Remove Cloud and Enterprise categories
RUN find /usr/share/grafana/public/build/ -name *.js \
-exec sed -i 's|.id==="enterprise"|.id==="notanenterprise"|g' {} \; \
-exec sed -i 's|.id==="cloud"|.id==="notacloud"|g' {} \;
##################################################################
## CLEANING
## Remove Native Panels
##################################################################
RUN rm -rf /usr/share/grafana/public/app/plugins/panel/alertlist \
/usr/share/grafana/public/app/plugins/panel/annolist \
/usr/share/grafana/public/app/plugins/panel/dashlist \
/usr/share/grafana/public/app/plugins/panel/news \
/usr/share/grafana/public/app/plugins/panel/geomap \
/usr/share/grafana/public/app/plugins/panel/table-old \
/usr/share/grafana/public/app/plugins/panel/traces \
/usr/share/grafana/public/app/plugins/panel/flamegraph
##################################################################
USER grafana
## Entrypoint
ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ]