FROM golang:1.26.5-alpine3.23@sha256:622e56dbc11a8cfe87cafa2331e9a201877271cbff918af53d3be315f3da88cc AS restic ARG X_TEXT_VERSION=v0.40.0 ARG X_NET_VERSION=v0.57.0 ENV GOTOOLCHAIN=local WORKDIR /src RUN go mod init who-need-help/restic-build \ && go get github.com/restic/restic/cmd/restic@v0.19.1 \ && go get google.golang.org/grpc@v1.82.1 \ && go get "golang.org/x/net@${X_NET_VERSION}" \ && go get "golang.org/x/text@${X_TEXT_VERSION}" \ && test "$(go list -m -f '{{.Version}}' google.golang.org/grpc)" = "v1.82.1" \ && test "$(go list -m -f '{{.Version}}' golang.org/x/net)" = "${X_NET_VERSION}" \ && test "$(go list -m -f '{{.Version}}' golang.org/x/text)" = "${X_TEXT_VERSION}" \ && CGO_ENABLED=0 go build \ -trimpath \ -ldflags="-s -w" \ -o /out/restic \ github.com/restic/restic/cmd/restic FROM alpine:3.23.3@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659 RUN apk add --no-cache \ ca-certificates=20260611-r0 \ libcrypto3=3.5.7-r0 \ libssl3=3.5.7-r0 \ musl=1.2.5-r23 \ musl-utils=1.2.5-r23 \ postgresql18-client=18.4-r0 \ zlib=1.3.2-r0 COPY --from=restic /out/restic /usr/local/bin/restic ENTRYPOINT [] USER 10001:10001 CMD ["restic", "version"]