From 0ab7fd4ee314755886727eff7559725d0af17c66 Mon Sep 17 00:00:00 2001 From: alanjino Date: Mon, 13 May 2024 22:06:26 +0530 Subject: [PATCH 1/3] docker base image changes --- dockerfiles/agent/container/Dockerfile | 5 +++-- dockerfiles/agent/git/Dockerfile | 5 +++-- dockerfiles/client/Dockerfile | 4 ++-- dockerfiles/migration/Dockerfile | 5 ++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dockerfiles/agent/container/Dockerfile b/dockerfiles/agent/container/Dockerfile index cc6431ee..c8b31212 100644 --- a/dockerfiles/agent/container/Dockerfile +++ b/dockerfiles/agent/container/Dockerfile @@ -1,11 +1,12 @@ -FROM golang:1.22 AS builder +FROM cgr.dev/chainguard/go:latest AS builder + WORKDIR / COPY ./ ./ RUN go mod download RUN CGO_ENABLED=0 go build -o ./build/agent agent/container/main.go -FROM scratch +FROM cgr.dev/chainguard/static:latest COPY --from=builder ./build/agent agent USER 65532:65532 diff --git a/dockerfiles/agent/git/Dockerfile b/dockerfiles/agent/git/Dockerfile index 10644da6..5b8656f1 100644 --- a/dockerfiles/agent/git/Dockerfile +++ b/dockerfiles/agent/git/Dockerfile @@ -1,11 +1,12 @@ -FROM golang:1.22 AS builder +FROM cgr.dev/chainguard/go:latest AS builder + WORKDIR / COPY ./ ./ RUN go mod download RUN CGO_ENABLED=0 go build -o ./build/agent agent/git/main.go -FROM scratch +FROM cgr.dev/chainguard/static:latest COPY --from=builder ./build/agent agent USER 65532:65532 diff --git a/dockerfiles/client/Dockerfile b/dockerfiles/client/Dockerfile index fda1470f..a8e03478 100644 --- a/dockerfiles/client/Dockerfile +++ b/dockerfiles/client/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.22 as builder +FROM cgr.dev/chainguard/go:latest AS builder WORKDIR /workspace # Copy the Go Modules manifests @@ -11,7 +11,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o k8smetri # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM golang:alpine +FROM cgr.dev/chainguard/static:latest WORKDIR / COPY --from=builder /workspace/k8smetrics_client . USER 65532:65532 diff --git a/dockerfiles/migration/Dockerfile b/dockerfiles/migration/Dockerfile index 5299a5a9..af93a514 100644 --- a/dockerfiles/migration/Dockerfile +++ b/dockerfiles/migration/Dockerfile @@ -1,5 +1,4 @@ -FROM golang:1.22 as builder - +FROM cgr.dev/chainguard/go:latest AS builder WORKDIR /workspace COPY ./ ./ RUN go mod download @@ -10,7 +9,7 @@ RUN chmod +x /workspace/script/wait-for-clickhouse.sh # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM golang:alpine +FROM cgr.dev/chainguard/wolfi-base RUN apk add --no-cache netcat-openbsd WORKDIR / COPY --from=builder /workspace/migration . From 16b709133f001cb5591dbbefbee45d419174465a Mon Sep 17 00:00:00 2001 From: alanjino Date: Tue, 14 May 2024 13:14:56 +0530 Subject: [PATCH 2/3] update: Added chainguard image as base image --- dockerfiles/agent/container/Dockerfile | 2 +- dockerfiles/agent/git/Dockerfile | 2 +- dockerfiles/client/Dockerfile | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dockerfiles/agent/container/Dockerfile b/dockerfiles/agent/container/Dockerfile index c8b31212..aa8c3955 100644 --- a/dockerfiles/agent/container/Dockerfile +++ b/dockerfiles/agent/container/Dockerfile @@ -6,7 +6,7 @@ COPY ./ ./ RUN go mod download RUN CGO_ENABLED=0 go build -o ./build/agent agent/container/main.go -FROM cgr.dev/chainguard/static:latest +FROM scratch COPY --from=builder ./build/agent agent USER 65532:65532 diff --git a/dockerfiles/agent/git/Dockerfile b/dockerfiles/agent/git/Dockerfile index 5b8656f1..b57e6586 100644 --- a/dockerfiles/agent/git/Dockerfile +++ b/dockerfiles/agent/git/Dockerfile @@ -6,7 +6,7 @@ COPY ./ ./ RUN go mod download RUN CGO_ENABLED=0 go build -o ./build/agent agent/git/main.go -FROM cgr.dev/chainguard/static:latest +FROM scratch COPY --from=builder ./build/agent agent USER 65532:65532 diff --git a/dockerfiles/client/Dockerfile b/dockerfiles/client/Dockerfile index a8e03478..6da67bae 100644 --- a/dockerfiles/client/Dockerfile +++ b/dockerfiles/client/Dockerfile @@ -1,6 +1,6 @@ # Build the manager binary FROM cgr.dev/chainguard/go:latest AS builder - +RUN apk update && apk add go-1.21 WORKDIR /workspace # Copy the Go Modules manifests COPY ./ ./ @@ -11,7 +11,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o k8smetri # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM cgr.dev/chainguard/static:latest +FROM scratch WORKDIR / COPY --from=builder /workspace/k8smetrics_client . USER 65532:65532 From 5f145499f3721ac6d3fc04d894a25658855b2dd7 Mon Sep 17 00:00:00 2001 From: alanjino Date: Tue, 14 May 2024 13:17:29 +0530 Subject: [PATCH 3/3] update: Added chainguard image as base image --- dockerfiles/client/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/client/Dockerfile b/dockerfiles/client/Dockerfile index 6da67bae..19436734 100644 --- a/dockerfiles/client/Dockerfile +++ b/dockerfiles/client/Dockerfile @@ -1,6 +1,6 @@ # Build the manager binary FROM cgr.dev/chainguard/go:latest AS builder -RUN apk update && apk add go-1.21 + WORKDIR /workspace # Copy the Go Modules manifests COPY ./ ./