Hello
I am trying to understand the source code better and am therefore trying to build grafana locally with docker. I am working on two machines, both run Ubuntu 20.04 one is standalone linux PC the oder a WSL2. As the title says I am using grafana 9.0.4. My docker version details:
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:02:57 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.6
runc:
Version: 1.1.2
docker-init:
Version: 0.19.0
I am either using ‘make’ or ‘docker’ both show the same error.
My docker command in the root directory reads
sudo docker build -t grafana-test:dev .
My make command reads:
sudo make build-docker-full
The build fails at step 28/48 in the go section:
user@***:***/grafana-9.0.6$ sudo docker build -t costum-grafana:latest .
Sending build context to Docker daemon 65.56MB
Step 1/48 : FROM node:16-alpine3.15 as js-builder
---> 7a960c1a5c45
Step 2/48 : ENV NODE_OPTIONS=--max_old_space_size=8000
---> Using cache
---> 816c9717ba8d
Step 3/48 : WORKDIR /grafana
---> Using cache
---> 093424667e70
Step 4/48 : COPY package.json yarn.lock .yarnrc.yml ./
---> Using cache
---> 3a329b7684e9
Step 5/48 : COPY .yarn .yarn
---> Using cache
---> e60dfa063b5d
Step 6/48 : COPY packages packages
---> Using cache
---> cc6e313444fb
Step 7/48 : COPY plugins-bundled plugins-bundled
---> Using cache
---> 842cfab70db6
Step 8/48 : RUN yarn install
---> Using cache
---> 25cf6a38162b
Step 9/48 : COPY tsconfig.json .eslintrc .editorconfig .browserslistrc .prettierrc.js babel.config.json .linguirc ./
---> Using cache
---> 860e7dbd00fd
Step 10/48 : COPY public public
---> Using cache
---> 1fe6edaeff70
Step 11/48 : COPY tools tools
---> Using cache
---> bcfa6fc50605
Step 12/48 : COPY scripts scripts
---> Using cache
---> e017fe88d473
Step 13/48 : COPY emails emails
---> Using cache
---> 93bc3d915691
Step 14/48 : ENV NODE_ENV production
---> Using cache
---> cafdbc36631c
Step 15/48 : RUN yarn build
---> Using cache
---> e7c2b2458042
Step 16/48 : FROM golang:1.17.12-alpine3.15 as go-builder
---> 05ba1ea45e87
Step 17/48 : RUN apk add --no-cache gcc g++ make
---> Using cache
---> 28c7534948b1
Step 18/48 : WORKDIR /grafana
---> Using cache
---> affe0cd0a1d9
Step 19/48 : COPY go.mod go.sum embed.go Makefile build.go package.json ./
---> Using cache
---> 7a84a58315ad
Step 20/48 : COPY packages/grafana-schema packages/grafana-schema
---> Using cache
---> ae780e15421e
Step 21/48 : COPY public/app/plugins public/app/plugins
---> Using cache
---> 93136066bd31
Step 22/48 : COPY public/api-spec.json public/api-spec.json
---> Using cache
---> 50ae37cd39ac
Step 23/48 : COPY pkg pkg
---> Using cache
---> 97d6faae13c9
Step 24/48 : COPY scripts scripts
---> Using cache
---> 7503fa013d96
Step 25/48 : COPY cue.mod cue.mod
---> Using cache
---> 24b0e039ef2a
Step 26/48 : COPY .bingo .bingo
---> Using cache
---> ec3e72782b37
Step 27/48 : RUN go mod verify
---> Using cache
---> 6dd9123449c5
Step 28/48 : RUN make build-go
---> Running in 2fd16d522236
go run pkg/api/docs/merge/merge_specs.go -o=public/api-merged.json public/api-spec.json pkg/services/ngalert/api/tooling/api.json
go: downloading github.com/go-openapi/loads v0.20.2
go: downloading github.com/go-openapi/spec v0.20.4
go: downloading github.com/go-openapi/analysis v0.20.1
go: downloading github.com/go-openapi/swag v0.19.15
go: downloading github.com/mailru/easyjson v0.7.7
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/go-openapi/jsonreference v0.19.6
go: downloading github.com/go-openapi/jsonpointer v0.19.5
go: downloading github.com/josharian/intern v1.0.0
go: downloading github.com/go-openapi/strfmt v0.20.2
go: downloading github.com/PuerkitoBio/purell v1.1.1
go: downloading golang.org/x/text v0.3.7
go: downloading golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: downloading github.com/mitchellh/mapstructure v1.4.3
go: downloading github.com/go-openapi/errors v0.20.0
go: downloading github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
go: downloading github.com/oklog/ulid v1.3.1
go: downloading go.mongodb.org/mongo-driver v1.7.0
go: downloading github.com/go-stack/stack v1.8.0
(re)installing /go/bin/wire-v0.5.0
go: downloading github.com/google/wire v0.5.0
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b
go: downloading github.com/google/subcommands v1.0.1
generate go files
/go/bin/wire-v0.5.0 gen -tags "oss" ./pkg/server ./pkg/cmd/grafana-cli/runner
wire: github.com/grafana/grafana/pkg/server: wrote /grafana/pkg/server/wire_gen.go
wire: github.com/grafana/grafana/pkg/cmd/grafana-cli/runner: wrote /grafana/pkg/cmd/grafana-cli/runner/wire_gen.go
build go files
go run build.go build
Version: 9.0.6, Linux Version: 9.0.6, Package Iteration: 1659905751
building binaries build
building grafana-server ./pkg/cmd/grafana-server
rm -r ./bin/linux-amd64/grafana-server
rm -r ./bin/linux-amd64/grafana-server.md5
go build -ldflags -w -X main.version=9.0.6 -X main.commit=unknown-dev -X main.buildstamp=1659905751 -X main.buildBranch=main -o ./bin/linux-amd64/grafana-server ./pkg/cmd/grafana-server
embed.go:9:20: pattern cue: no matching files found
exit status 1
exit status 1
make: *** [Makefile:92: build-go] Error 1
The command '/bin/sh -c make build-go' returned a non-zero code: 2
Sadly there are no further logs anywhere in /tmp or /grafana after the build fails.
Funny about the error is that ‘/bin/linux-amd64/grafana-server’ gets deleted and then the command go build -ldflags -w -X main.version=9.0.6 -X main.commit=unknown-dev -X main.buildstamp=1659905751 -X main.buildBranch=main -o ./bin/linux-amd64/grafana-server ./pkg/cmd/grafana-server
can’t find matching files as it’s trying to access the deleted folder.
How can it be, that the folder gets deleted and is then being accessed?
Is there some parallelsim overlay going on?
If anyone who reads this and has no anwser to my problem but was able to build the image locally (on ubuntu) let me know your enviromental setup for building the image.
Thanks!