restic-docker/Dockerfile

31 lines
843 B
Docker

FROM alpine:latest as alpine
RUN apk add --no-cache \
ca-certificates \
tzdata
FROM busybox:glibc
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo
# Get restic executable
ENV RESTIC_VERSION=0.15.1
ADD https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 /
RUN bzip2 -d restic_${RESTIC_VERSION}_linux_amd64.bz2 && mv restic_${RESTIC_VERSION}_linux_amd64 /bin/restic && chmod +x /bin/restic
RUN mkdir -p /mnt/restic /var/spool/cron/crontabs /var/log
# /data is the dir where you have to put the data to be backed up
VOLUME /data
COPY backup.sh /bin/backup
COPY check.sh /bin/check
COPY entry.sh /entry.sh
RUN touch /var/log/cron.log
WORKDIR "/"
ENTRYPOINT ["/entry.sh"]