Last active
January 3, 2023 18:41
-
-
Save solsson/449f3ceba74859df5b6ead8f16b11dfa to your computer and use it in GitHub Desktop.
DEPRECATED see https://github.com/Yolean/kubernetes-mixin-managed build.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
[ -z "$DEBUG" ] || set -x | |
set -e | |
# For https://github.com/Yolean/kubernetes-mixin-managed/ | |
BUILDER=kubernetes-mixin-builder:local | |
BUILDUSER="$(id -u):$(id -g)" | |
CACHEDIR="$(pwd)/tmp/go-mod-cache" | |
#cat <<EOF | docker buildx build --output=type=docker --tag $BUILDER - | |
cat <<EOF | docker build --tag $BUILDER - | |
FROM golang:1.17.6-bullseye | |
# this is arm64, for x86 switch to https://hub.docker.com/layers/grafana/jsonnet-build/4fd8fef/images/sha256-bb7efa8ff0ccc7a865d7c74fb09378d0d10133011dc7a85db9af59148800192b?context=explore | |
COPY --from=grafana/jsonnet-build:3989b8d@sha256:16b842c300a84fd541fbdd3a47a2ee8bc93b5be363ebf1605746e7063318f747 \ | |
/usr/bin/jsonnet /usr/local/bin/jsonnet | |
RUN go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.4.0 | |
RUN go install github.com/brancz/gojsontoyaml@v0.1.0 | |
RUN echo 'nonroot:x:$BUILDUSER:nonroot:/home/nonroot:/usr/sbin/nologin' >> /etc/passwd && \ | |
mkdir -p /home/nonroot && touch /home/nonroot/.bash_history && chown -R $BUILDUSER /home/nonroot | |
RUN chown -R nonroot /go | |
USER nonroot:nogroup | |
EOF | |
docker run --rm --name kubernetes-mixin-builder \ | |
-u $BUILDUSER \ | |
-v $(pwd):/home/nonroot/kubernetes-mixin -w /home/nonroot/kubernetes-mixin \ | |
-v $CACHEDIR:/go/pkg/mod/cache \ | |
--entrypoint /bin/bash \ | |
$BUILDER -cex ' \ | |
make prometheus_alerts.yaml; \ | |
make prometheus_rules.yaml; \ | |
make dashboards_out; \ | |
cp $(which gojsontoyaml) tmp/bin/; \ | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment