-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from intergral/update
Update
- Loading branch information
Showing
26 changed files
with
4,352 additions
and
4,359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"version": "5.10.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,12 @@ ARG grafana_image=grafana-enterprise | |
|
||
FROM grafana/${grafana_image}:${grafana_version} | ||
|
||
ARG development=false | ||
ARG TARGETARCH | ||
|
||
|
||
ENV DEV "${development}" | ||
|
||
# Make it as simple as possible to access the grafana instance for development purposes | ||
# Do NOT enable these settings in a public facing / production grafana instance | ||
ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin" | ||
|
@@ -11,6 +17,37 @@ ENV GF_AUTH_BASIC_ENABLED "false" | |
# Set development mode so plugins can be loaded without the need to sign | ||
ENV GF_DEFAULT_APP_MODE "development" | ||
|
||
# Inject livereload script into grafana index.html | ||
|
||
LABEL maintainer="Grafana Labs <[email protected]>" | ||
|
||
ENV GF_PATHS_HOME="/usr/share/grafana" | ||
WORKDIR $GF_PATHS_HOME | ||
|
||
USER root | ||
RUN sed -i 's/<\/body><\/html>/<script src=\"http:\/\/localhost:35729\/livereload.js\"><\/script><\/body><\/html>/g' /usr/share/grafana/public/views/index.html | ||
|
||
# Installing supervisor and inotify-tools | ||
RUN if [ "${development}" = "true" ]; then \ | ||
if grep -i -q alpine /etc/issue; then \ | ||
apk add supervisor inotify-tools git; \ | ||
elif grep -i -q ubuntu /etc/issue; then \ | ||
DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get update && \ | ||
apt-get install -y supervisor inotify-tools git && \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
else \ | ||
echo 'ERROR: Unsupported base image' && /bin/false; \ | ||
fi \ | ||
fi | ||
|
||
COPY supervisord/supervisord.conf /etc/supervisor.d/supervisord.ini | ||
COPY supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
|
||
|
||
# Inject livereload script into grafana index.html | ||
RUN sed -i 's|</body>|<script src="http://localhost:35729/livereload.js"></script></body>|g' /usr/share/grafana/public/views/index.html | ||
|
||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
if [ "${DEV}" = "false" ]; then | ||
echo "Starting test mode" | ||
exec /run.sh | ||
fi | ||
|
||
echo "Starting development mode" | ||
|
||
if grep -i -q alpine /etc/issue; then | ||
exec /usr/bin/supervisord -c /etc/supervisord.conf | ||
elif grep -i -q ubuntu /etc/issue; then | ||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf | ||
else | ||
echo 'ERROR: Unsupported base image' | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[supervisord] | ||
nodaemon=true | ||
user=root | ||
|
||
[program:grafana] | ||
user=root | ||
directory=/var/lib/grafana | ||
command=/run.sh | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
killasgroup=true | ||
stopasgroup=true | ||
autostart=true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as webpack from 'webpack'; | ||
|
||
const PLUGIN_NAME = 'BuildModeWebpack'; | ||
|
||
export class BuildModeWebpackPlugin { | ||
apply(compiler: webpack.Compiler) { | ||
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { | ||
compilation.hooks.processAssets.tap( | ||
{ | ||
name: PLUGIN_NAME, | ||
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS, | ||
}, | ||
async () => { | ||
const assets = compilation.getAssets(); | ||
for (const asset of assets) { | ||
if (asset.name.endsWith('plugin.json')) { | ||
const pluginJsonString = asset.source.source().toString(); | ||
const pluginJsonWithBuildMode = JSON.stringify( | ||
{ | ||
...JSON.parse(pluginJsonString), | ||
buildMode: compilation.options.mode, | ||
}, | ||
null, | ||
4 | ||
); | ||
compilation.updateAsset(asset.name, new webpack.sources.RawSource(pluginJsonWithBuildMode)); | ||
} | ||
} | ||
} | ||
); | ||
}); | ||
} | ||
} |
Oops, something went wrong.