From 4e9c670a00d80192839ff60e41b3be55ac0ae252 Mon Sep 17 00:00:00 2001 From: Josh Hunt Date: Thu, 17 Jul 2025 12:49:16 +0100 Subject: [PATCH] FrontendService: Fix backend.dockerfile (#108195) * FrontendService: Fix backend.dockerfile * comments * Fix backends rebuilding image instead of just restarting when assets change * route /logout to grafana backend * fix script in dockerfile --- Dockerfile | 3 ++- devenv/frontend-service/Tiltfile | 2 +- devenv/frontend-service/backend.dockerfile | 4 ++-- devenv/frontend-service/nginx.conf | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4de7a9b5b09..07874fff677 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,7 +69,8 @@ COPY go.* ./ COPY .bingo .bingo COPY .citools .citools -# Include vendored dependencies +# Copy go dependencies first +# If updating this, please also update devenv/frontend-service/backend.dockerfile COPY pkg/util/xorm pkg/util/xorm COPY pkg/apiserver pkg/apiserver COPY pkg/apimachinery pkg/apimachinery diff --git a/devenv/frontend-service/Tiltfile b/devenv/frontend-service/Tiltfile index 887045ec5e2..36709821fa7 100644 --- a/devenv/frontend-service/Tiltfile +++ b/devenv/frontend-service/Tiltfile @@ -62,7 +62,7 @@ docker_build('grafana-backend', '../..', "./public/build/assets-manifest.json", ], live_update = [ - sync('./public/build/assets-manifest.json', '/grafana/public/build/assets-manifest.json'), + sync('../../public/build/assets-manifest.json', '/grafana/public/build/assets-manifest.json'), restart_container() ] ) diff --git a/devenv/frontend-service/backend.dockerfile b/devenv/frontend-service/backend.dockerfile index 83b190d1728..bfc89735d1a 100644 --- a/devenv/frontend-service/backend.dockerfile +++ b/devenv/frontend-service/backend.dockerfile @@ -20,7 +20,8 @@ RUN go env GOPATH COPY Makefile devenv/frontend-service/build-grafana.sh ./ # Copy go mod files first -# $: ls -1 {pkg,scripts,apps}**/go.{mod,sum} | sed 's#\(.*\)/go\.\(mod\|sum\)#COPY \1/go.* \1/#' | sort -u +# run this command and replace the output below: +# find pkg scripts apps -type f \( -name go.mod -o -name go.sum \) -print | sed -E 's#(.*)/go\.(mod|sum)$#COPY \1/go.* \1/#' | sort -u COPY apps/advisor/go.* apps/advisor/ COPY apps/alerting/notifications/go.* apps/alerting/notifications/ COPY apps/dashboard/go.* apps/dashboard/ @@ -31,7 +32,6 @@ COPY apps/playlist/go.* apps/playlist/ COPY apps/secret/go.* apps/secret/ COPY pkg/aggregator/go.* pkg/aggregator/ COPY pkg/apimachinery/go.* pkg/apimachinery/ -COPY pkg/apis/secret/go.* pkg/apis/secret/ COPY pkg/apiserver/go.* pkg/apiserver/ COPY pkg/build/go.* pkg/build/ COPY pkg/build/wire/go.* pkg/build/wire/ diff --git a/devenv/frontend-service/nginx.conf b/devenv/frontend-service/nginx.conf index fa61a70b8e7..5927c492e53 100644 --- a/devenv/frontend-service/nginx.conf +++ b/devenv/frontend-service/nginx.conf @@ -36,7 +36,7 @@ server { # API calls go to the backend # Cheat with app plugin paths and route them to the backend. These should come from # the Plugin CDN - location ~ ^/(api|apis|bootdata|public\/plugins\/grafana\-\w+\-app) { + location ~ ^/(api|apis|bootdata|logout|public\/plugins\/grafana\-\w+\-app) { proxy_pass http://backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;