diff --git a/Makefile b/Makefile index 8f345f96d37a6..cadce23fe2624 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ BUILD_IN_CONTAINER ?= true # ensure you run `make drone` and `make release-workflows` after changing this BUILD_IMAGE_VERSION ?= 0.33.4 +GO_VERSION := 1.22.5 # Docker image info IMAGE_PREFIX ?= grafana @@ -141,7 +142,7 @@ logcli: cmd/logcli/logcli ## build logcli executable logcli-debug: cmd/logcli/logcli-debug ## build debug logcli executable logcli-image: ## build logcli docker image - $(SUDO) docker build -t $(IMAGE_PREFIX)/logcli:$(IMAGE_TAG) -f cmd/logcli/Dockerfile . + $(SUDO) docker build --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/logcli:$(IMAGE_TAG) -f cmd/logcli/Dockerfile . cmd/logcli/logcli: CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./cmd/logcli @@ -597,9 +598,9 @@ endef # promtail promtail-image: ## build the promtail docker image - $(SUDO) docker build -t $(IMAGE_PREFIX)/promtail:$(IMAGE_TAG) -f clients/cmd/promtail/Dockerfile . + $(SUDO) docker build --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/promtail:$(IMAGE_TAG) -f clients/cmd/promtail/Dockerfile . promtail-image-cross: - $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/promtail:$(IMAGE_TAG) -f clients/cmd/promtail/Dockerfile.cross . + $(SUDO) $(BUILD_OCI) --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/promtail:$(IMAGE_TAG) -f clients/cmd/promtail/Dockerfile.cross . promtail-debug-image: ## build the promtail debug docker image $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/promtail:$(IMAGE_TAG)-debug -f clients/cmd/promtail/Dockerfile.debug . @@ -609,47 +610,47 @@ promtail-push: promtail-image-cross # loki loki-image: ## build the loki docker image - $(SUDO) docker build -t $(IMAGE_PREFIX)/loki:$(IMAGE_TAG) -f cmd/loki/Dockerfile . + $(SUDO) docker build --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki:$(IMAGE_TAG) -f cmd/loki/Dockerfile . loki-image-cross: - $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki:$(IMAGE_TAG) -f cmd/loki/Dockerfile.cross . + $(SUDO) $(BUILD_OCI) --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki:$(IMAGE_TAG) -f cmd/loki/Dockerfile.cross . loki-debug-image: ## build the debug loki docker image - $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki:$(IMAGE_TAG)-debug -f cmd/loki/Dockerfile.debug . + $(SUDO) $(BUILD_OCI) --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki:$(IMAGE_TAG)-debug -f cmd/loki/Dockerfile.debug . loki-push: loki-image-cross $(call push-image,loki) # loki-canary loki-canary-image: ## build the loki canary docker image - $(SUDO) docker build -t $(IMAGE_PREFIX)/loki-canary:$(IMAGE_TAG) -f cmd/loki-canary/Dockerfile . + $(SUDO) docker build --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-canary:$(IMAGE_TAG) -f cmd/loki-canary/Dockerfile . loki-canary-image-cross: - $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki-canary:$(IMAGE_TAG) -f cmd/loki-canary/Dockerfile.cross . + $(SUDO) $(BUILD_OCI) --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-canary:$(IMAGE_TAG) -f cmd/loki-canary/Dockerfile.cross . loki-canary-image-cross-boringcrypto: - $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki-canary-boringcrypto:$(IMAGE_TAG) -f cmd/loki-canary-boringcrypto/Dockerfile . + $(SUDO) $(BUILD_OCI) --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-canary-boringcrypto:$(IMAGE_TAG) -f cmd/loki-canary-boringcrypto/Dockerfile . loki-canary-push: loki-canary-image-cross $(SUDO) $(PUSH_OCI) $(IMAGE_PREFIX)/loki-canary:$(IMAGE_TAG) loki-canary-push-boringcrypto: loki-canary-image-cross-boringcrypto $(SUDO) $(PUSH_OCI) $(IMAGE_PREFIX)/loki-canary-boringcrypto:$(IMAGE_TAG) helm-test-image: ## build the helm test image - $(SUDO) docker build -t $(IMAGE_PREFIX)/loki-helm-test:$(IMAGE_TAG) -f production/helm/loki/src/helm-test/Dockerfile . + $(SUDO) docker build --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-helm-test:$(IMAGE_TAG) -f production/helm/loki/src/helm-test/Dockerfile . helm-test-push: helm-test-image ## push the helm test image $(SUDO) $(PUSH_OCI) $(IMAGE_PREFIX)/loki-helm-test:$(IMAGE_TAG) # loki-querytee loki-querytee-image: - $(SUDO) docker build -t $(IMAGE_PREFIX)/loki-query-tee:$(IMAGE_TAG) -f cmd/querytee/Dockerfile . + $(SUDO) docker build --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-query-tee:$(IMAGE_TAG) -f cmd/querytee/Dockerfile . loki-querytee-image-cross: - $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki-query-tee:$(IMAGE_TAG) -f cmd/querytee/Dockerfile.cross . + $(SUDO) $(BUILD_OCI) --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-query-tee:$(IMAGE_TAG) -f cmd/querytee/Dockerfile.cross . loki-querytee-push: loki-querytee-image-cross $(SUDO) $(PUSH_OCI) $(IMAGE_PREFIX)/loki-query-tee:$(IMAGE_TAG) # migrate-image migrate-image: - $(SUDO) docker build -t $(IMAGE_PREFIX)/loki-migrate:$(IMAGE_TAG) -f cmd/migrate/Dockerfile . + $(SUDO) docker build --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-migrate:$(IMAGE_TAG) -f cmd/migrate/Dockerfile . # LogQL Analyzer logql-analyzer-image: ## build the LogQL Analyzer image - $(SUDO) docker build -t $(IMAGE_PREFIX)/logql-analyzer:$(IMAGE_TAG) -f cmd/logql-analyzer/Dockerfile . + $(SUDO) docker build --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/logql-analyzer:$(IMAGE_TAG) -f cmd/logql-analyzer/Dockerfile . logql-analyzer-push: logql-analyzer-image ## push the LogQL Analyzer image $(call push-image,logql-analyzer) @@ -663,7 +664,7 @@ else endif build-image: ensure-buildx-builder - $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki-build-image:$(IMAGE_TAG) ./loki-build-image + $(SUDO) $(BUILD_OCI) --build-arg=GO_VERSION=$(GO_VERSION) -t $(IMAGE_PREFIX)/loki-build-image:$(IMAGE_TAG) ./loki-build-image build-image-push: build-image ## push the docker build image ifneq (,$(findstring WIP,$(IMAGE_TAG))) @echo "Cannot push a WIP image, commit changes first"; \ diff --git a/clients/cmd/promtail/Dockerfile b/clients/cmd/promtail/Dockerfile index 0ac16613ea51a..3c9088bb83ba9 100644 --- a/clients/cmd/promtail/Dockerfile +++ b/clients/cmd/promtail/Dockerfile @@ -1,4 +1,5 @@ -FROM golang:1.22.5-bookworm as build +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION}-bookworm as build COPY . /src/loki WORKDIR /src/loki diff --git a/clients/cmd/promtail/Dockerfile.cross b/clients/cmd/promtail/Dockerfile.cross index ff9f3ac565e83..572e6394f4597 100644 --- a/clients/cmd/promtail/Dockerfile.cross +++ b/clients/cmd/promtail/Dockerfile.cross @@ -1,8 +1,9 @@ ARG BUILD_IMAGE=grafana/loki-build-image:0.33.4 +ARG GO_VERSION=1.22 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/promtail -f clients/cmd/promtail/Dockerfile . -FROM 1.22.2-alpine as goenv +FROM golang:${GO_VERSION}-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/cmd/logcli/Dockerfile b/cmd/logcli/Dockerfile index ffcbef10ecfb5..999434d075a8b 100644 --- a/cmd/logcli/Dockerfile +++ b/cmd/logcli/Dockerfile @@ -1,13 +1,15 @@ -FROM golang:1.22.5 as build +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION} as build COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false logcli -FROM alpine:3.18.5 -RUN apk add --no-cache ca-certificates +FROM gcr.io/distroless/base-nossl:debug COPY --from=build /src/loki/cmd/logcli/logcli /usr/bin/logcli +SHELL [ "/busybox/sh", "-c" ] +RUN ln -s /busybox/sh /bin/sh ENTRYPOINT [ "/usr/bin/logcli" ] diff --git a/cmd/logql-analyzer/Dockerfile b/cmd/logql-analyzer/Dockerfile index 4908bbb7da1ea..53ba7bee94b4e 100644 --- a/cmd/logql-analyzer/Dockerfile +++ b/cmd/logql-analyzer/Dockerfile @@ -1,13 +1,14 @@ -FROM golang:1.22.5 as build +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION} as build COPY . /src/loki WORKDIR /src/loki RUN make clean && CGO_ENABLED=0 go build ./cmd/logql-analyzer/ -FROM alpine:3.18.5 - -RUN apk add --no-cache ca-certificates +FROM gcr.io/distroless/base-nossl:debug COPY --from=build /src/loki/logql-analyzer /usr/bin/logql-analyzer +SHELL [ "/busybox/sh", "-c" ] +RUN ln -s /busybox/sh /bin/sh ENTRYPOINT [ "/usr/bin/logql-analyzer" ] diff --git a/cmd/loki-canary-boringcrypto/Dockerfile b/cmd/loki-canary-boringcrypto/Dockerfile index c1217cc3f68ec..e69be2c0aeb63 100644 --- a/cmd/loki-canary-boringcrypto/Dockerfile +++ b/cmd/loki-canary-boringcrypto/Dockerfile @@ -1,12 +1,13 @@ -FROM golang:1.22.5 as build +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION} as build COPY . /src/loki WORKDIR /src/loki RUN go env GOARCH > /goarch RUN make clean && make GOARCH=$(cat /goarch) BUILD_IN_CONTAINER=true GOEXPERIMENT=boringcrypto loki-canary-boringcrypto -FROM alpine:3.18.5 -RUN apk add --update --no-cache ca-certificates -RUN apk add --no-cache libc6-compat +FROM gcr.io/distroless/base-nossl:debug COPY --from=build /src/loki/cmd/loki-canary-boringcrypto/loki-canary-boringcrypto /usr/bin/loki-canary +SHELL [ "/busybox/sh", "-c" ] +RUN ln -s /busybox/sh /bin/sh ENTRYPOINT [ "/usr/bin/loki-canary" ] diff --git a/cmd/loki-canary/Dockerfile b/cmd/loki-canary/Dockerfile index cf0f60c695e3a..f0dcf02d5d815 100644 --- a/cmd/loki-canary/Dockerfile +++ b/cmd/loki-canary/Dockerfile @@ -1,10 +1,13 @@ -FROM golang:1.22.5 as build +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION} as build COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false loki-canary -FROM alpine:3.18.5 -RUN apk add --update --no-cache ca-certificates +FROM gcr.io/distroless/base-nossl:debug + COPY --from=build /src/loki/cmd/loki-canary/loki-canary /usr/bin/loki-canary +SHELL [ "/busybox/sh", "-c" ] +RUN ln -s /busybox/sh /bin/sh ENTRYPOINT [ "/usr/bin/loki-canary" ] diff --git a/cmd/loki-canary/Dockerfile.cross b/cmd/loki-canary/Dockerfile.cross index b56f292e5561d..e1f7b133313a3 100644 --- a/cmd/loki-canary/Dockerfile.cross +++ b/cmd/loki-canary/Dockerfile.cross @@ -1,18 +1,20 @@ ARG BUILD_IMAGE=grafana/loki-build-image:0.33.4 +ARG GO_VERSION=1.22 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/promtail -f cmd/promtail/Dockerfile . -FROM golang:1.22.5-alpine as goenv +FROM golang:${GO_VERSION} as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm -FROM --platform=linux/amd64 $BUILD_IMAGE as build +FROM $BUILD_IMAGE as build COPY --from=goenv /goarch /goarm / COPY . /src/loki WORKDIR /src/loki RUN make clean && GOARCH=$(cat /goarch) GOARM=$(cat /goarm) make BUILD_IN_CONTAINER=false loki-canary -FROM alpine:3.18.5 -RUN apk add --update --no-cache ca-certificates +FROM gcr.io/distroless/base-nossl:debug COPY --from=build /src/loki/cmd/loki-canary/loki-canary /usr/bin/loki-canary +SHELL [ "/busybox/sh", "-c" ] +RUN ln -s /busybox/sh /bin/sh ENTRYPOINT [ "/usr/bin/loki-canary" ] diff --git a/cmd/loki/Dockerfile b/cmd/loki/Dockerfile index 6052f41ca54f1..521c591595736 100644 --- a/cmd/loki/Dockerfile +++ b/cmd/loki/Dockerfile @@ -1,22 +1,23 @@ -FROM golang:1.22.5 as build +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION} as build COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false loki -FROM alpine:3.18.5 - -RUN apk add --no-cache ca-certificates libcap +FROM gcr.io/distroless/base-nossl:debug COPY --from=build /src/loki/cmd/loki/loki /usr/bin/loki COPY cmd/loki/loki-docker-config.yaml /etc/loki/local-config.yaml +SHELL [ "/busybox/sh", "-c" ] + RUN addgroup -g 10001 -S loki && \ adduser -u 10001 -S loki -G loki RUN mkdir -p /loki/rules && \ mkdir -p /loki/rules-temp && \ - chown -R loki:loki /etc/loki /loki - + chown -R loki:loki /etc/loki /loki && \ + ln -s /busybox/sh /bin/sh USER 10001 EXPOSE 3100 ENTRYPOINT [ "/usr/bin/loki" ] diff --git a/cmd/loki/Dockerfile.cross b/cmd/loki/Dockerfile.cross index 52b18a302bdbd..da9d358d28c5f 100644 --- a/cmd/loki/Dockerfile.cross +++ b/cmd/loki/Dockerfile.cross @@ -1,28 +1,27 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.33.4 +ARG GO_VERSION=1.22 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/loki -f cmd/loki/Dockerfile . -FROM golang:1.22.5-alpine as goenv +FROM golang:${GO_VERSION} as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm -FROM --platform=linux/amd64 $BUILD_IMAGE as build -COPY --from=goenv /goarch /goarm / COPY . /src/loki WORKDIR /src/loki RUN make clean && GOARCH=$(cat /goarch) GOARM=$(cat /goarm) make BUILD_IN_CONTAINER=false loki -FROM alpine:3.18.5 +FROM gcr.io/distroless/base-nossl:debug -RUN apk add --no-cache ca-certificates - -COPY --from=build /src/loki/cmd/loki/loki /usr/bin/loki +COPY --from=goenv /src/loki/cmd/loki/loki /usr/bin/loki COPY cmd/loki/loki-local-config.yaml /etc/loki/local-config.yaml +SHELL [ "/busybox/sh", "-c" ] + RUN addgroup -g 10001 -S loki && \ adduser -u 10001 -S loki -G loki RUN mkdir -p /loki && \ - chown -R loki:loki /etc/loki /loki + chown -R loki:loki /etc/loki /loki && \ + ln -s /busybox/sh /bin/sh USER 10001 EXPOSE 3100 diff --git a/cmd/loki/Dockerfile.debug b/cmd/loki/Dockerfile.debug index a943cb57f0d16..bb23778d9af33 100644 --- a/cmd/loki/Dockerfile.debug +++ b/cmd/loki/Dockerfile.debug @@ -1,22 +1,22 @@ ARG BUILD_IMAGE=grafana/loki-build-image:0.33.4 +ARG GO_VERSION=1.22 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/loki -f cmd/loki/Dockerfile.debug . -FROM golang:1.22.5-alpine as goenv +FROM golang:${GO_VERSION} as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm && \ go install github.com/go-delve/delve/cmd/dlv@latest -FROM --platform=linux/amd64 $BUILD_IMAGE as build +FROM $BUILD_IMAGE as build COPY --from=goenv /goarch /goarm / COPY . /src/loki WORKDIR /src/loki RUN make clean && \ GOARCH=$(cat /goarch) GOARM=$(cat /goarm) make BUILD_IN_CONTAINER=false loki-debug -FROM alpine:3.18.5 -RUN apk add --update --no-cache ca-certificates +FROM gcr.io/distroless/base-nossl:debug COPY --from=build /src/loki/cmd/loki/loki-debug /usr/bin/loki-debug COPY --from=goenv /go/bin/dlv /usr/bin/dlv COPY cmd/loki/loki-docker-config.yaml /etc/loki/local-config.yaml @@ -25,8 +25,9 @@ EXPOSE 3100 # Expose 40000 for delve EXPOSE 40000 -# Allow delve to run on Alpine based containers. -RUN apk add --no-cache libc6-compat +SHELL [ "/busybox/sh", "-c" ] +RUN ln -s /busybox/sh /bin/sh + # Run delve, ending with -- because we pass params via kubernetes, per the docs: # Pass flags to the program you are debugging using --, for example:` diff --git a/cmd/migrate/Dockerfile b/cmd/migrate/Dockerfile index e50554d50d6be..a24697a719f2b 100644 --- a/cmd/migrate/Dockerfile +++ b/cmd/migrate/Dockerfile @@ -1,10 +1,12 @@ -FROM golang:1.22.5 as build +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION} as build COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false migrate -FROM alpine:3.18.5 -RUN apk add --update --no-cache ca-certificates +FROM gcr.io/distroless/base-nossl:debug + COPY --from=build /src/loki/cmd/migrate/migrate /usr/bin/migrate -#ENTRYPOINT [ "/usr/bin/migrate" ] -CMD tail -f /dev/null +SHELL [ "/busybox/sh", "-c" ] +RUN ln -s /busybox/sh /bin/sh +ENTRYPOINT [ "/busybox/tail", "-f", "/dev/null" ] diff --git a/cmd/querytee/Dockerfile b/cmd/querytee/Dockerfile index f2bfcefa02660..ea86fe0249ee0 100644 --- a/cmd/querytee/Dockerfile +++ b/cmd/querytee/Dockerfile @@ -1,10 +1,14 @@ -FROM golang:1.22.5 as build +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION} as build COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false loki-querytee -FROM alpine:3.18.5 -RUN apk add --update --no-cache ca-certificates +FROM gcr.io/distroless/base-nossl:debug COPY --from=build /src/loki/cmd/querytee/querytee /usr/bin/querytee + +SHELL [ "/busybox/sh", "-c" ] +RUN ln -s /busybox/sh /bin/sh + ENTRYPOINT [ "/usr/bin/querytee" ] diff --git a/cmd/querytee/Dockerfile.cross b/cmd/querytee/Dockerfile.cross index 005ebabbc2175..e0cec2a4cbddb 100644 --- a/cmd/querytee/Dockerfile.cross +++ b/cmd/querytee/Dockerfile.cross @@ -2,17 +2,19 @@ ARG BUILD_IMAGE=grafana/loki-build-image:0.33.4 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/promtail -f cmd/promtail/Dockerfile . -FROM golang:1.22.5-alpine as goenv +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION} as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm -FROM --platform=linux/amd64 $BUILD_IMAGE as build +FROM $BUILD_IMAGE as build COPY --from=goenv /goarch /goarm / COPY . /src/loki WORKDIR /src/loki RUN make clean && GOARCH=$(cat /goarch) GOARM=$(cat /goarm) make BUILD_IN_CONTAINER=false loki-querytee -FROM alpine:3.18.5 -RUN apk add --update --no-cache ca-certificates +FROM gcr.io/distroless/base-nossl:debug COPY --from=build /src/loki/cmd/querytee/querytee /usr/bin/querytee +SHELL [ "/busybox/sh", "-c" ] +RUN ln -s /busybox/sh /bin/sh ENTRYPOINT [ "/usr/bin/querytee" ] diff --git a/loki-build-image/Dockerfile b/loki-build-image/Dockerfile index 25c95578e4534..6b49181606c48 100644 --- a/loki-build-image/Dockerfile +++ b/loki-build-image/Dockerfile @@ -4,9 +4,9 @@ # tag of the Docker image in `../.drone/drone.jsonnet` and run `make drone`. # See ../docs/sources/community/maintaining/release-loki-build-image.md for instructions # on how to publish a new build image. - +ARG GO_VERSION=1.22 # Install helm (https://helm.sh/) and helm-docs (https://github.com/norwoodj/helm-docs) for generating Helm Chart reference. -FROM golang:1.22.5-bookworm as helm +FROM golang:${GO_VERSION}-bookworm as helm ARG TARGETARCH ARG HELM_VER="v3.2.3" RUN curl -L "https://get.helm.sh/helm-${HELM_VER}-linux-$TARGETARCH.tar.gz" | tar zx && \ @@ -38,7 +38,7 @@ RUN apk add --no-cache curl && \ FROM alpine:3.18.6 as docker RUN apk add --no-cache docker-cli docker-cli-buildx -FROM golang:1.22.5-bookworm as drone +FROM golang:${GO_VERSION}-bookworm as drone ARG TARGETARCH RUN curl -L "https://github.com/drone/drone-cli/releases/download/v1.7.0/drone_linux_$TARGETARCH".tar.gz | tar zx && \ install -t /usr/local/bin drone @@ -48,35 +48,35 @@ RUN curl -L "https://github.com/drone/drone-cli/releases/download/v1.7.0/drone_l # Error: # github.com/fatih/faillint@v1.5.0 requires golang.org/x/tools@v0.0.0-20200207224406-61798d64f025 # (not golang.org/x/tools@v0.0.0-20190918214920-58d531046acd from golang.org/x/tools/cmd/goyacc@58d531046acdc757f177387bc1725bfa79895d69) -FROM golang:1.22.5-bookworm as faillint +FROM golang:${GO_VERSION}-bookworm as faillint RUN GO111MODULE=on go install github.com/fatih/faillint@v1.12.0 RUN GO111MODULE=on go install golang.org/x/tools/cmd/goimports@v0.7.0 -FROM golang:1.22.5-bookworm as delve +FROM golang:${GO_VERSION}-bookworm as delve RUN GO111MODULE=on go install github.com/go-delve/delve/cmd/dlv@latest # Install ghr used to push binaries and template the release # This collides with the version of go tools used in the base image, thus we install it in its own image and copy it over. -FROM golang:1.22.5-bookworm as ghr +FROM golang:${GO_VERSION}-bookworm as ghr RUN GO111MODULE=on go install github.com/tcnksm/ghr@9349474 # Install nfpm (https://nfpm.goreleaser.com) for creating .deb and .rpm packages. -FROM golang:1.22.5-bookworm as nfpm +FROM golang:${GO_VERSION}-bookworm as nfpm RUN GO111MODULE=on go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.11.3 # Install gotestsum -FROM golang:1.22.5-bookworm as gotestsum +FROM golang:${GO_VERSION}-bookworm as gotestsum RUN GO111MODULE=on go install gotest.tools/gotestsum@v1.8.2 # Install tools used to compile jsonnet. -FROM golang:1.22.5-bookworm as jsonnet +FROM golang:${GO_VERSION}-bookworm as jsonnet RUN GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.5.1 RUN GO111MODULE=on go install github.com/monitoring-mixins/mixtool/cmd/mixtool@16dc166166d91e93475b86b9355a4faed2400c18 RUN GO111MODULE=on go install github.com/google/go-jsonnet/cmd/jsonnet@v0.20.0 FROM aquasec/trivy as trivy -FROM golang:1.22.5-bookworm +FROM golang:${GO_VERSION}-bookworm RUN apt-get update && \ apt-get install -qy \ musl gnupg ragel \ diff --git a/production/helm/loki/src/helm-test/Dockerfile b/production/helm/loki/src/helm-test/Dockerfile index 48ff7e8a6a275..bb71f28b98edc 100644 --- a/production/helm/loki/src/helm-test/Dockerfile +++ b/production/helm/loki/src/helm-test/Dockerfile @@ -1,4 +1,5 @@ -FROM golang:1.22.2 as build +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION} as build # build via Makefile target helm-test-image in root # Makefile. Building from this directory will not be @@ -7,7 +8,6 @@ COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false helm-test -FROM alpine:3.18.5 -RUN apk add --update --no-cache ca-certificates=20230506-r0 +FROM gcr.io/distroless/base-nossl:debug COPY --from=build /src/loki/production/helm/loki/src/helm-test/helm-test /usr/bin/helm-test ENTRYPOINT [ "/usr/bin/helm-test" ]