This commit is contained in:
bel
2021-09-14 06:38:09 -06:00
commit 9684eedac7
9 changed files with 180 additions and 0 deletions

22
restic/Dockerfile Executable file
View File

@@ -0,0 +1,22 @@
FROM golang:1.12.5-alpine3.9 as rbuilder
ENV GOPATH=/go
RUN apk add --no-cache git bash ca-certificates
RUN go get github.com/restic/restic
WORKDIR /go/src/github.com/restic/restic/cmd/restic
RUN git checkout v0.9.5
RUN CGO_ENABLED=0 go build -o /go/bin/restic -a -installsuffix cgo
FROM alpine:3.9
WORKDIR /main
RUN apk add --no-cache ca-certificates bash
COPY --from=rbuilder /go/bin/ /main
VOLUME /mnt
RUN echo \
'out="$(/main/restic init /mnt 2>&1 | grep -v config.file.already.exists | grep -v created.restic.repository | tr -d "\\n" )"; if test -n "$out"; then printf "ERR: $out\n"; else exec /main/restic "$@"; fi' \
> /entrypoint.sh \
&& chmod +x /entrypoint.sh
CMD []
ENTRYPOINT ["bash", "/entrypoint.sh"]