diff --git a/monitoring-as-code/Dockerfile b/monitoring-as-code/Dockerfile index dfceb9e9..5efa7b38 100644 --- a/monitoring-as-code/Dockerfile +++ b/monitoring-as-code/Dockerfile @@ -1,30 +1,25 @@ # Builder image to download binaries -FROM golang:1.19.0-alpine3.15 AS builder +FROM golang:1.19.0-alpine3.16 AS builder # Download git, jsonnet and jsonnet-bundler -# RUN apk add --no-cache git=2.36.2-r0 curl jq wget && \ -RUN apk add --no-cache git=2.36.2-r0 curl jq wget && \ - go install github.com/google/go-jsonnet/cmd/jsonnet@v0.18.0 && \ +RUN apk add --no-cache git=2.36.2-r0 && \ + go install github.com/google/go-jsonnet/cmd/jsonnet@v0.17.0 && \ go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.5.1 -# Download promtool -RUN VERSION=$(curl -Ls https://api.github.com/repos/prometheus/prometheus/releases/latest | jq ".tag_name" | xargs | cut -c2-) && \ - wget -qO- "https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-$VERSION.linux-amd64.tar.gz" \ - | tar xvzf - "prometheus-$VERSION.linux-amd64"/promtool --strip-components=1 && cp promtool /go/bin/promtool +WORKDIR /go/grafonnet +# Download grafonnet and grafana-builder +RUN jb init && \ + jb install https://github.com/grafana/grafonnet-lib/grafonnet && \ + jb install https://github.com/grafana/jsonnet-libs/grafana-builder FROM alpine:3.16.2 AS runner -RUN apk --no-cache add git bash # Pass semver or PR from GitHub workflow ARG MAC_VERSION ENV MAC_VERSION $MAC_VERSION -# Download grafonnet and grafana-builder COPY --from=builder /go/bin/* /usr/local/bin/ -RUN jb init && \ - jb install https://github.com/grafana/grafonnet-lib/grafonnet && \ - jb install https://github.com/grafana/jsonnet-libs/grafana-builder - +COPY --from=builder /go/grafonnet / COPY src /src COPY mixin-defs /mixin-defs COPY run-mixin.sh /