2024-08-08 07:47:42 +00:00
|
|
|
FROM scratch AS base
|
2024-03-29 00:43:41 +00:00
|
|
|
ENV VERSION=0.2.0
|
|
|
|
ENV SRC_HASH=80690d0d702b997aeb1ae6d6a7dc8ea8800d64c7307c004209387947bbd33aa2
|
|
|
|
ENV SRC_FILE=v${VERSION}.tar.gz
|
|
|
|
ENV SRC_SITE=https://github.com/joshdk/ksops-dry-run/archive/refs/tags/${SRC_FILE}
|
|
|
|
ENV GOPATH=/cache/go
|
|
|
|
ENV GOCACHE=/cache/
|
|
|
|
ENV GOWORK=off
|
|
|
|
ENV GOPROXY=https://proxy.golang.org,direct
|
|
|
|
ENV GOSUMDB=sum.golang.org
|
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
ENV GOHOSTOS=linux
|
|
|
|
ENV GOHOSTARCH=amd64
|
|
|
|
ENV GO11MODULE=off
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM base AS fetch
|
2024-03-29 00:43:41 +00:00
|
|
|
COPY --from=stagex/busybox . /
|
|
|
|
COPY --from=stagex/go . /
|
|
|
|
COPY --from=stagex/ca-certificates . /
|
|
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
|
|
|
RUN tar -xvf ${SRC_FILE}
|
2024-08-26 01:18:52 +00:00
|
|
|
WORKDIR /ksops-dry-run-${VERSION}
|
2024-03-29 00:43:41 +00:00
|
|
|
RUN go get ./...
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM fetch AS build
|
2024-03-29 00:43:41 +00:00
|
|
|
RUN --network=none \
|
|
|
|
go build \
|
|
|
|
-v \
|
|
|
|
-trimpath \
|
|
|
|
-ldflags "-s -w -X main.version=${VERSION} -buildid="
|
|
|
|
|
2024-08-08 07:50:50 +00:00
|
|
|
FROM build AS install
|
2024-03-29 00:43:41 +00:00
|
|
|
RUN <<-EOF
|
2024-04-11 20:09:20 +00:00
|
|
|
set -eux
|
2024-03-29 00:43:41 +00:00
|
|
|
mkdir -p /rootfs/usr/lib/kustomize/plugins/viduct.ai/v1/ksops
|
|
|
|
cp ksops-dry-run /rootfs/usr/lib/kustomize/plugins/viduct.ai/v1/ksops/ksops
|
|
|
|
EOF
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM stagex/filesystem AS package
|
2024-03-29 00:43:41 +00:00
|
|
|
COPY --from=install /rootfs/./ /
|