Dockerfile: disable saving Golang telemetry in dev-container

Disable collecting local telemetry, as collected by Go and Delve;

- https://github.com/go-delve/delve/blob/v1.24.1/CHANGELOG.md#1231-2024-09-23
- https://go.dev/doc/telemetry#background

Telemetry is only collected, and not sent by default, so let's skip producing
it in the first place, as the dev-container is an ephemeral environment, and
this telemetry is not used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-03-23 14:44:39 +01:00
parent e1e6d35277
commit 081987b647

View File

@@ -47,6 +47,11 @@ COPY --from=build-dummy /build /build
# base
FROM --platform=$BUILDPLATFORM ${GOLANG_IMAGE} AS base
COPY --from=xx / /
# Disable collecting local telemetry, as collected by Go and Delve;
#
# - https://github.com/go-delve/delve/blob/v1.24.1/CHANGELOG.md#1231-2024-09-23
# - https://go.dev/doc/telemetry#background
RUN go telemetry off && [ "$(go telemetry)" = "off" ] || { echo "Failed to disable Go telemetry"; exit 1; }
RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN apt-get update && apt-get install --no-install-recommends -y file
ENV GO111MODULE=off