Skip to content

Instantly share code, notes, and snippets.

@rhuss
Last active June 22, 2020 21:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rhuss/0df7b379eb24c8478bc9dce60aa11b3e to your computer and use it in GitHub Desktop.
Save rhuss/0df7b379eb24c8478bc9dce60aa11b3e to your computer and use it in GitHub Desktop.
Restic + Rclone for ARM

Cross compile this with ARM (+ an AMD image) and Docker Buildkit:

# Prepare
docker buildx create --name xbuilder
docker buildx use xbuilder
docker buildx inspect --bootstrap

# Build
docker buildx build -f Dockerfile --platform linux/arm/v7,linux/amd64 --progress plain --push -t rhuss/restic:0.9.6 .

Of course, adapt the final image name to push. Takes a bit (> 10 mins) but then you have a nice image for backing up your k3s local persistent volumes on your raspi cluster ;-)

FROM golang:1.13.10-buster AS builder
ARG VERSION_RESTIC=v0.9.6
ARG VERSION_RCLONE=v1.51.0
WORKDIR /opt
RUN apt-get update \
&& apt-get install -y \
git \
make
RUN git clone https://github.com/rclone/rclone.git \
&& cd rclone \
&& git checkout $VERSION_RCLONE -b $VERSION_RCLONE \
&& CGO_ENABLED=0 make \
&& ./rclone version \
&& cd ..
RUN git clone https://github.com/restic/restic.git \
&& cd restic \
&& git checkout $VERSION_RESTIC -b $VERSION_RESTIC \
&& go run build.go \
&& ./restic version \
&& cd ..
FROM alpine:3.11
WORKDIR /
COPY --from=builder /opt/restic/restic /usr/bin/restic
COPY --from=builder /opt/rclone/rclone /usr/bin/rclone
ENTRYPOINT ["/usr/bin/restic"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment