From 6408518582fb2a1b529f5c9fb0c595df230f3df6 Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Wed, 17 Apr 2024 20:14:42 -0700 Subject: [PATCH] fix: add tini to docker images to reap rclone processes left behind by restic --- Dockerfile.alpine | 6 +++--- Dockerfile.scratch | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 79b04d7f..33f2bf6f 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,9 +1,9 @@ FROM alpine:latest -RUN apk --no-cache add ca-certificates curl bash rclone openssh tzdata +RUN apk --no-cache add tini ca-certificates curl bash rclone openssh tzdata RUN mkdir -p /tmp COPY backrest /backrest RUN /backrest --install-deps-only RUN mkdir -p /bin && mv /root/.local/share/backrest/* /bin -ENTRYPOINT ["/backrest"] -RUN /backrest --install-deps-only +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["/backrest"] \ No newline at end of file diff --git a/Dockerfile.scratch b/Dockerfile.scratch index 22f09ba1..993e1f34 100644 --- a/Dockerfile.scratch +++ b/Dockerfile.scratch @@ -1,13 +1,16 @@ -FROM golang:alpine as gobuild +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/* /bin FROM scratch -COPY --from=gobuild /tmp-orig /tmp -COPY --from=gobuild /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=gobuild /bin /bin +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 -ENTRYPOINT ["/backrest"] -COPY backrest /backrest \ No newline at end of file +ENTRYPOINT ["/tini", "--"] +CMD ["/backrest"] \ No newline at end of file