who_need_help/Dockerfile.backup

40 lines
1.2 KiB
Docker

FROM golang:1.26.7-alpine3.23@sha256:b17af760035fc2f338eed92d448a6c67f2d45438844fc6c60678fa5f99e44b57 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.8-r0 \
libssl3=3.5.8-r0 \
musl=1.2.5-r23 \
musl-utils=1.2.5-r23 \
postgresql18-client=18.6-r0 \
zlib=1.3.2-r0
COPY --from=restic /out/restic /usr/local/bin/restic
ENTRYPOINT []
USER 10001:10001
CMD ["restic", "version"]