Skip to content

Commit

Permalink
Modification to use devcontainer for Grafana Scene app development
Browse files Browse the repository at this point in the history
  • Loading branch information
cbos committed Dec 15, 2023
1 parent 168fccf commit cf5866d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .config/Dockerfile
Expand Up @@ -10,7 +10,8 @@ ENV GF_AUTH_ANONYMOUS_ENABLED "true"
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"
ARG livereload_host=http:\\/\\/localhost:35729

# Inject livereload script into grafana index.html
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
RUN sed -i "s/<\/body><\/html>/<script src='${livereload_host}\/livereload.js'><\/script><\/body><\/html>/g" /usr/share/grafana/public/views/index.html
22 changes: 19 additions & 3 deletions .devcontainer/devcontainer.json
@@ -1,5 +1,21 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
}
}
"waitFor": "onCreateCommand",
"updateContentCommand": "npm install",
"postCreateCommand": "",
"postAttachCommand": {
"server": "npm run dev",
"grafana": "npm run server"
},
"portsAttributes": {
"35729": {
"label": "Application",
"onAutoForward": "silent"
},
"3000": {
"label": "Grafana",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [35729, 3000]
}
7 changes: 4 additions & 3 deletions docker-compose.yaml
@@ -1,4 +1,4 @@
npversion: '3.0'
version: '3.0'

services:
grafana:
Expand All @@ -7,8 +7,9 @@ services:
build:
context: ./.config
args:
grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise}
grafana_version: ${GRAFANA_VERSION:-10.0.3}
grafana_image: ${GRAFANA_IMAGE:-grafana}
grafana_version: ${GRAFANA_VERSION:-10.2.0}
livereload_host: "https:\\/\\/${CODESPACE_NAME}-35729.app.github.dev"
ports:
- 3000:3000/tcp
volumes:
Expand Down

0 comments on commit cf5866d

Please sign in to comment.