Skip to content

Instantly share code, notes, and snippets.

@redbaron
Created August 15, 2023 09:33
Show Gist options
  • Save redbaron/441e1b68f7e11b49ff038fafada5a3b6 to your computer and use it in GitHub Desktop.
Save redbaron/441e1b68f7e11b49ff038fafada5a3b6 to your computer and use it in GitHub Desktop.
Local telegraf build
FROM golang:1.21 AS build
WORKDIR /app
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build,rw go mod download
COPY . ./
RUN --mount=type=cache,target=/root/.cache/go-build,rw go build -p 1 -o /telegraf ./cmd/telegraf
FROM gcr.io/distroless/base-debian11
WORKDIR /app
COPY --from=build /telegraf /telegraf
USER nonroot:nonroot
ENTRYPOINT ["/telegraf"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment