# Stage 1: Dependencies (Alpine) FROM alpine:latest AS alpine RUN apk add --no-cache ca-certificates tini-static RUN mkdir /tmp-orig ARG TARGETPLATFORM # Binaries are staged per-platform by goreleaser dockers_v2 COPY $TARGETPLATFORM/backrest /backrest RUN /backrest --install-deps-only # Setup restic path RUN mkdir -p /bin && mv /root/.local/share/backrest/restic /bin/restic # Stage 2: Final Image (Scratch) 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/restic /bin/restic COPY --from=alpine /sbin/tini-static /tini ARG TARGETPLATFORM COPY $TARGETPLATFORM/backrest /backrest COPY $TARGETPLATFORM/docker-entrypoint /docker-entrypoint ENTRYPOINT ["/tini", "--", "/docker-entrypoint"] CMD ["/backrest"]