2024-02-09 07:30:28 +00:00
|
|
|
FROM scratch as base
|
2023-12-25 05:03:48 +00:00
|
|
|
ENV VERSION=3.8.1
|
|
|
|
ENV SRC_HASH=5ca70fb4f96797d09012c705a5bb935835896de7bcd063b98d498912b0e645a0
|
2024-02-09 07:30:28 +00:00
|
|
|
ENV SRC_FILE=${SRC_SITE}/v${VERSION}.tar.gz
|
|
|
|
ENV SRC_SITE=https://github.com/getsops/sops/archive/refs/tags/${SRC_FILE}
|
2023-12-25 05:03:48 +00:00
|
|
|
|
|
|
|
FROM base as fetch
|
2024-02-09 07:30:28 +00:00
|
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
2023-12-25 05:03:48 +00:00
|
|
|
|
|
|
|
FROM fetch as build
|
2024-02-15 15:22:38 +00:00
|
|
|
COPY --from=stagex/busybox . /
|
|
|
|
COPY --from=stagex/go . /
|
|
|
|
COPY --from=stagex/ca-certificates . /
|
2023-12-25 05:03:48 +00:00
|
|
|
RUN tar -xvf v${VERSION}.tar.gz
|
|
|
|
WORKDIR sops-${VERSION}
|
|
|
|
ENV PWD=/home/user/sops-${VERSION}
|
|
|
|
ENV GOPATH=${PWD}/cache/go
|
|
|
|
ENV GOCACHE=${PWD}/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
|
2024-02-05 10:36:12 +00:00
|
|
|
ENV GOFLAGS=-trimpath
|
2023-12-25 05:03:48 +00:00
|
|
|
RUN mkdir -p ${GOPATH}
|
|
|
|
RUN go build -o bin/sops ./cmd/sops
|
|
|
|
|
|
|
|
from build as install
|
2024-02-09 07:30:28 +00:00
|
|
|
RUN <<-EOF
|
|
|
|
mkdir -p /rootfs/usr/bin/
|
|
|
|
cp bin/sops /rootfs/usr/bin/
|
|
|
|
EOF
|
2024-02-09 18:19:36 +00:00
|
|
|
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
2023-12-25 05:03:48 +00:00
|
|
|
|
2024-03-01 18:30:23 +00:00
|
|
|
FROM stagex/filesystem as package
|
|
|
|
COPY --from=install /rootfs/./ /
|