mirror of
https://github.com/ViViDboarder/docker-restic-cron.git
synced 2024-11-21 20:56:36 +00:00
Add x86 and arm builds and tests
This commit is contained in:
parent
c5d673885e
commit
e42eef8fcd
@ -1,2 +1,5 @@
|
|||||||
|
Dockerfile.*
|
||||||
|
Makefile
|
||||||
Readme.md
|
Readme.md
|
||||||
docker-compose.yaml
|
docker-compose.yaml
|
||||||
|
test.sh
|
||||||
|
29
Dockerfile.raspbian
Normal file
29
Dockerfile.raspbian
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
FROM resin/rpi-raspbian:jessie
|
||||||
|
MAINTAINER ViViDboarder <vividboarder@gmail.com>
|
||||||
|
|
||||||
|
RUN [ "cross-build-start" ]
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y duplicity python-setuptools \
|
||||||
|
python-boto python-swiftclient python-pexpect openssh-client \
|
||||||
|
&& rm -rf /var/apt/lists/*
|
||||||
|
|
||||||
|
RUN [ "cross-build-end" ]
|
||||||
|
|
||||||
|
VOLUME "/root/.cache/duplicity"
|
||||||
|
VOLUME "/backups"
|
||||||
|
|
||||||
|
ENV BACKUP_DEST="file:///backups"
|
||||||
|
ENV BACKUP_NAME="backup"
|
||||||
|
ENV PATH_TO_BACKUP="/data"
|
||||||
|
ENV PASSPHRASE="Correct.Horse.Battery.Staple"
|
||||||
|
|
||||||
|
# Cron schedules
|
||||||
|
ENV CRON_SCHEDULE=""
|
||||||
|
ENV VERIFY_CRON_SCHEDULE=""
|
||||||
|
|
||||||
|
ADD entrypoint.sh /
|
||||||
|
ADD backup.sh /
|
||||||
|
ADD verify.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/entrypoint.sh" ]
|
@ -23,5 +23,6 @@ ENV VERIFY_CRON_SCHEDULE=""
|
|||||||
|
|
||||||
ADD entrypoint.sh /
|
ADD entrypoint.sh /
|
||||||
ADD backup.sh /
|
ADD backup.sh /
|
||||||
|
ADD verify.sh /
|
||||||
|
|
||||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
ENTRYPOINT [ "/entrypoint.sh" ]
|
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
.PHONY: build-x86 build-arm build-all
|
||||||
|
|
||||||
|
DOCKER_TAG ?= docker-duplicity-cron
|
||||||
|
|
||||||
|
default: build-x86
|
||||||
|
|
||||||
|
build-x86:
|
||||||
|
docker build -f ./Dockerfile.ubuntu -t $(DOCKER_TAG):ubuntu .
|
||||||
|
|
||||||
|
build-arm:
|
||||||
|
docker build -f ./Dockerfile.raspbian -t $(DOCKER_TAG):raspbian .
|
||||||
|
|
||||||
|
build-all: build-x86 build-arm
|
||||||
|
|
||||||
|
test-x86: build-x86
|
||||||
|
./test.sh $(DOCKER_TAG) ubuntu
|
||||||
|
|
||||||
|
test-arm: build-arm
|
||||||
|
./test.sh $(DOCKER_TAG) raspbian
|
||||||
|
|
||||||
|
test-all: test-x86 test-arm
|
@ -25,7 +25,7 @@ if [ -n "$CRON_SCHEDULE" ]; then
|
|||||||
echo "Backups scheduled as $CRON_SCHEDULE"
|
echo "Backups scheduled as $CRON_SCHEDULE"
|
||||||
|
|
||||||
if [ -n "$VERIFY_CRON_SCHEDULE" ]; then
|
if [ -n "$VERIFY_CRON_SCHEDULE" ]; then
|
||||||
echo "$VERIFY_CRON_SCHEDULE source /env.sh && duplicity verify $BACKUP_DEST $PATH_TO_BACKUP" >> /crontab.conf
|
echo "$VERIFY_CRON_SCHEDULE source /env.sh && /verify.sh 2>> /cron.log" >> /crontab.conf
|
||||||
echo "Verify scheduled as $VERIFY_CRON_SCHEDULE"
|
echo "Verify scheduled as $VERIFY_CRON_SCHEDULE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
15
test.sh
Executable file
15
test.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
image_name=$1
|
||||||
|
tag=$2
|
||||||
|
|
||||||
|
full_image="${image_name}:${tag}"
|
||||||
|
container_name="${image_name}-${tag}"
|
||||||
|
|
||||||
|
docker run -d -e CRON_SCHEDULE="0 0 12 1 1 ? *" -e SKIP_ON_START=true --name $container_name $full_image
|
||||||
|
sleep 2
|
||||||
|
docker exec $container_name sh -c "mkdir -p /data && echo Test > /data/test.txt"
|
||||||
|
docker exec $container_name /backup.sh
|
||||||
|
docker exec $container_name /verify.sh
|
||||||
|
docker stop $container_name
|
||||||
|
docker rm $container_name
|
Loading…
Reference in New Issue
Block a user