Merge branch 'master' into alpine

This commit is contained in:
Tobias Kaupat
2019-09-19 10:27:26 +02:00
committed by GitHub
3 changed files with 19 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
FROM alpine:3.10.1 as build FROM alpine:3.10.1 as certs
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
# Get restic executable # Get restic executable
@@ -6,12 +6,20 @@ ENV RESTIC_VERSION=0.9.5
ADD https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 / 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 bzip2 -d restic_${RESTIC_VERSION}_linux_amd64.bz2 && mv restic_${RESTIC_VERSION}_linux_amd64 /bin/restic && chmod +x /bin/restic
FROM alpine:3.10.1 FROM alpine as rclone
COPY --from=build /etc/ssl/certs /etc/ssl/certs # Get rclone executable
COPY --from=build /bin/restic /bin/restic ADD https://downloads.rclone.org/rclone-current-linux-amd64.zip /
RUN unzip rclone-current-linux-amd64.zip && mv rclone-*-linux-amd64/rclone /bin/rclone && chmod +x /bin/rclone
RUN apk add --update --no-cache fuse openssh-client heirloom-mailx FROM busybox:glibc
# install mailx
RUN apk add --update --no-cache heirloom-mailx
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
COPY --from=certs /bin/restic /bin/restic
COPY --from=rclone /bin/rclone /bin/rclone
RUN \ RUN \
mkdir -p /mnt/restic /var/spool/cron/crontabs /var/log; \ mkdir -p /mnt/restic /var/spool/cron/crontabs /var/log; \

View File

@@ -89,7 +89,7 @@ Since restic saves the hostname with each snapshot and the hostname of a docker
Either by setting the [environment variable](https://docs.docker.com/engine/reference/run/#env-environment-variables) `HOSTNAME` or with `--hostname` in the [network settings](https://docs.docker.com/engine/reference/run/#network-settings) Either by setting the [environment variable](https://docs.docker.com/engine/reference/run/#env-environment-variables) `HOSTNAME` or with `--hostname` in the [network settings](https://docs.docker.com/engine/reference/run/#network-settings)
## Backup to SFTP ## Backup via SFTP
Since restic needs a **password less login** to the SFTP server make sure you can do `sftp user@host` from inside the container. If you can do so from your host system, the easiest way is to just mount your `.ssh` folder conaining the authorized cert into the container by specifying `-v ~/.ssh:/root/.ssh` as argument for `docker run`. Since restic needs a **password less login** to the SFTP server make sure you can do `sftp user@host` from inside the container. If you can do so from your host system, the easiest way is to just mount your `.ssh` folder conaining the authorized cert into the container by specifying `-v ~/.ssh:/root/.ssh` as argument for `docker run`.
@@ -99,6 +99,10 @@ Now you can simply specify the restic repository to be an [SFTP repository](http
-e "RESTIC_REPOSITORY=sftp:user@host:/tmp/backup" -e "RESTIC_REPOSITORY=sftp:user@host:/tmp/backup"
``` ```
## Backup via rclone
To use rclone as a backend for restic, simply add the rclone config file as a volume with `-v /absolute/path/to/rclone.conf:/root/.config/rclone/rclone.conf`.
# Versioning & Changelog # Versioning & Changelog
Starting from v1.3.0 versioning follows [Semantic versioning](http://semver.org/) Starting from v1.3.0 versioning follows [Semantic versioning](http://semver.org/)

View File

@@ -1,7 +1,7 @@
version: '2' version: '2'
services: services:
test: sut:
image: gcr.io/gcp-runtimes/container-structure-test image: gcr.io/gcp-runtimes/container-structure-test
command: ["test", "--image", "restic-backup", "--config", "config.yml"] command: ["test", "--image", "restic-backup", "--config", "config.yml"]
volumes: volumes: