2024-08-08 07:47:42 +00:00
|
|
|
FROM scratch AS base
|
2024-03-19 04:46:04 +00:00
|
|
|
ENV VERSION=4.42.1
|
|
|
|
ENV SRC_HASH=be31e5e828a0251721ea71964596832d4a40cbc21c8a8392a804bc8d1c55dd62
|
|
|
|
ENV SRC_FILE=v${VERSION}.tar.gz
|
|
|
|
ENV SRC_SITE=https://github.com/mikefarah/yq/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=on
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM base AS fetch
|
2024-03-19 04:46:04 +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}
|
|
|
|
WORKDIR yq-${VERSION}
|
|
|
|
RUN go get ./...
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM fetch AS build
|
2024-03-19 04:46:04 +00:00
|
|
|
RUN --network=none go build -v -trimpath
|
|
|
|
|
|
|
|
from build as install
|
|
|
|
RUN <<-EOF
|
|
|
|
mkdir -p /rootfs/usr/bin/
|
|
|
|
cp yq /rootfs/usr/bin/
|
|
|
|
EOF
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM stagex/filesystem AS package
|
2024-03-19 04:46:04 +00:00
|
|
|
COPY --from=install /rootfs/./ /
|