lyft / clutch

Extensible platform for infrastructure management
https://clutch.sh
Apache License 2.0
1.7k stars 120 forks source link

can't compile #3173

Open sid-occrp opened 1 week ago

sid-occrp commented 1 week ago

Description

I'm trying to build the docker container executing ´docker build -t clutch:latest .´

Expected Behavior

The build should complete successfully.

Actual Behavior

=> ERROR [gobuild 7/7] RUN make backend-with-assets                                                                                                                                                      0.2s
------
 > [gobuild 7/7] RUN make backend-with-assets:
0.201 /go/src/github.com/lyft/clutch
0.201 Running pre-flight checks...
0.213 Pre-flight checks satisfied!
0.213 cd backend && go run cmd/assets/generate.go ../frontend/packages/app/build && go build -tags withAssets -o ../build/clutch -ldflags="-X main.version=0.0.0"
0.219 go: errors parsing go.mod:
0.219 /go/src/github.com/lyft/clutch/backend/go.mod:3: invalid go version '1.23.0': must match format 1.23
0.220 make: *** [Makefile:47: backend-with-assets] Error 1
------
Dockerfile:19
--------------------
  17 |     COPY --from=nodebuild ./frontend/packages/app/build ./frontend/packages/app/build/
  18 |
  19 | >>> RUN make backend-with-assets
  20 |
  21 |     # Copy binary to final image.
--------------------
ERROR: failed to solve: process "/bin/sh -c make backend-with-assets" did not complete successfully: exit code: 2

I've tried modifying the go.mod to go 1.23 but still the build fail with:

87.75 go: downloading github.com/emicklei/go-restful/v3 v3.11.0
90.75 /go/pkg/mod/k8s.io/apimachinery@v0.30.1/pkg/util/sets/set.go:20:2: package cmp is not in GOROOT (/usr/local/go/src/cmp)
90.75 note: imported by a module that requires go 1.22
90.76 make: *** [Makefile:47: backend-with-assets] Error 1
------
Dockerfile:19
--------------------
  17 |     COPY --from=nodebuild ./frontend/packages/app/build ./frontend/packages/app/build/
  18 |
  19 | >>> RUN make backend-with-assets
  20 |
  21 |     # Copy binary to final image.
--------------------
ERROR: failed to solve: process "/bin/sh -c make backend-with-assets" did not complete successfully: exit code: 2

Version 2a2f4fe817e42fb15d3f58f615fe5301647a1680, current HEAD

samuel-gamelin commented 6 days ago

The following Dockerfile changes worked for me:

diff --git a/Dockerfile b/Dockerfile
index f4b0aec6..4553de93 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,7 +8,7 @@ COPY Makefile .
 RUN make frontend

 # Backend build.
-FROM golang:1.20.5-buster as gobuild
+FROM golang:1.23.0-bookworm as gobuild
 WORKDIR /go/src/github.com/lyft/clutch
 COPY ./backend ./backend
 COPY ./tools/preflight-checks.sh ./tools/preflight-checks.sh
@@ -19,7 +19,7 @@ COPY --from=nodebuild ./frontend/packages/app/build ./frontend/packages/app/buil
 RUN make backend-with-assets

 # Copy binary to final image.
-FROM gcr.io/distroless/base-debian10
+FROM gcr.io/distroless/base-debian12
 COPY --from=gobuild /go/src/github.com/lyft/clutch/build/clutch /
 COPY backend/clutch-config.yaml /
 CMD ["/clutch"]