FROM golang:1.25-alpine AS builder WORKDIR /src COPY . . RUN go build -o /docker-entrypoint -ldflags "-s -w" ./cmd/docker-entrypoint FROM alpine:latest AS alpine RUN apk add --no-cache ca-certificates tini-static RUN mkdir /tmp-orig COPY backrest /backrest RUN /backrest --install-deps-only RUN mkdir -p /bin && mv /root/.local/share/backrest/restic /bin/restic FROM scratch LABEL org.opencontainers.image.source="https://github.com/garethgeorge/backrest" COPY --from=alpine /tmp-orig /tmp COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=alpine /bin /bin COPY --from=alpine /sbin/tini-static /tini COPY backrest /backrest COPY --from=builder /docker-entrypoint /docker-entrypoint ENTRYPOINT ["/tini", "--", "/docker-entrypoint"] CMD ["/backrest"]