mirror of
https://github.com/lobaro/restic-backup-docker.git
synced 2026-02-17 09:23:56 +00:00
Merge pull request #87 from zimbres/master
Multiarch Docker images / Backup_Sources Folder option
This commit is contained in:
1
.github/workflows/docker-publish.yml
vendored
1
.github/workflows/docker-publish.yml
vendored
@@ -72,6 +72,7 @@ jobs:
|
||||
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
* Option to set the target folder backup
|
||||
* Multi-platform image build
|
||||
|
||||
## v1.3.2 (restic 0.16.0)
|
||||
|
||||
### Changed
|
||||
|
||||
16
Dockerfile
16
Dockerfile
@@ -1,8 +1,17 @@
|
||||
FROM docker.io/alpine:latest as rclone
|
||||
FROM --platform=$TARGETPLATFORM docker.io/alpine:latest as rclone
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
RUN apk add wget
|
||||
|
||||
# Get rclone executable
|
||||
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 if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||
wget https://downloads.rclone.org/rclone-current-linux-amd64.zip && unzip rclone-current-linux-amd64.zip && mv rclone-*-linux-amd64/rclone /bin/rclone && chmod +x /bin/rclone; \
|
||||
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
||||
wget https://downloads.rclone.org/rclone-current-linux-arm64.zip && unzip rclone-current-linux-arm64.zip && mv rclone-*-linux-arm64/rclone /bin/rclone && chmod +x /bin/rclone; \
|
||||
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
|
||||
wget https://downloads.rclone.org/rclone-current-linux-arm-v7.zip && unzip rclone-current-linux-arm-v7.zip && mv rclone-*-linux-arm-v7/rclone /bin/rclone && chmod +x /bin/rclone; \
|
||||
fi
|
||||
|
||||
|
||||
FROM docker.io/restic/restic:0.18.0
|
||||
|
||||
@@ -35,6 +44,7 @@ ENV OS_PASSWORD=""
|
||||
ENV OS_REGION_NAME=""
|
||||
ENV OS_INTERFACE=""
|
||||
ENV OS_IDENTITY_API_VERSION=3
|
||||
ENV BACKUP_SOURCES=""
|
||||
|
||||
# openshift fix
|
||||
RUN mkdir /.cache && \
|
||||
|
||||
@@ -142,6 +142,7 @@ The container is set up by setting [environment variables](https://docs.docker.c
|
||||
* `OS_REGION_NAME` - Optional. When using restic with OpenStack Swift container.
|
||||
* `OS_INTERFACE` - Optional. When using restic with OpenStack Swift container.
|
||||
* `OS_IDENTITY_API_VERSION` - Optional. When using restic with OpenStack Swift container.
|
||||
* `BACKUP_SOURCES` - Optional. Set the folder that will be backed up.
|
||||
|
||||
## Volumes
|
||||
|
||||
|
||||
@@ -4,6 +4,12 @@ lastLogfile="/var/log/backup-last.log"
|
||||
lastMailLogfile="/var/log/mail-last.log"
|
||||
lastMicrosoftTeamsLogfile="/var/log/microsoft-teams-last.log"
|
||||
|
||||
if [ -n "$BACKUP_SOURCES" ]; then
|
||||
backupSources="$BACKUP_SOURCES"
|
||||
else
|
||||
backupSources="/data"
|
||||
fi
|
||||
|
||||
copyErrorLog() {
|
||||
cp ${lastLogfile} /var/log/backup-error-last.log
|
||||
}
|
||||
@@ -31,7 +37,7 @@ logLast "RESTIC_REPOSITORY: ${RESTIC_REPOSITORY}"
|
||||
logLast "AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}"
|
||||
|
||||
# Do not save full backup log to logfile but to backup-last.log
|
||||
restic backup /data ${RESTIC_JOB_ARGS} --tag=${RESTIC_TAG?"Missing environment variable RESTIC_TAG"} >> ${lastLogfile} 2>&1
|
||||
restic backup ${backupSources} ${RESTIC_JOB_ARGS} --tag=${RESTIC_TAG?"Missing environment variable RESTIC_TAG"} >> ${lastLogfile} 2>&1
|
||||
backupRC=$?
|
||||
logLast "Finished backup at $(date)"
|
||||
if [[ $backupRC == 0 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user