diff --git a/.travis.yml b/.travis.yml index 7b85e78..2d0849c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,10 @@ +--- sudo: required services: docker script: - # - make build-all - - make test-x86 + - docker run --rm --privileged multiarch/qemu-user-static:register --reset + - make build-all + - make test-all + # test-s3-arm has issues, but the image works in the wild - make test-s3-x86 diff --git a/Dockerfile b/Dockerfile index ee951d9..41e9e0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ -FROM ubuntu:xenial -MAINTAINER ViViDboarder +ARG REPO=library +FROM ${REPO}/ubuntu:xenial +LABEL maintainer="ViViDboarder " RUN apt-get update \ && apt-get install -y --no-install-recommends \ @@ -23,8 +24,8 @@ RUN apt-get update \ python-urllib3 \ rsync \ tahoe-lafs \ - && pip install -U --no-cache-dir boto b2 \ - && apt-get autoremove -y python-pip \ + && pip install -U --no-cache-dir boto==2.49.0 b2==1.4.2 \ + && apt-get autoremove -y python-pip python-setuptools \ && apt-get clean \ && rm -rf /var/apt/lists/* diff --git a/Dockerfile.armhf b/Dockerfile.armhf deleted file mode 100644 index df90446..0000000 --- a/Dockerfile.armhf +++ /dev/null @@ -1,57 +0,0 @@ -FROM raspbian/jessie -MAINTAINER ViViDboarder - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - cron \ - duplicity \ - lftp \ - ncftp \ - openssh-client \ - python-cloudfiles \ - python-gdata \ - python-oauthlib \ - python-paramiko \ - python-pexpect \ - python-pip \ - python-urllib3 \ - rsync \ - tahoe-lafs \ - && pip install --no-cache-dir -U setuptools \ - && pip install --no-cache-dir -U boto b2 \ - && apt-get remove -y python-pip \ - && apt-get install -y --no-install-recommends \ - python-swiftclient \ - && rm -rf /var/apt/lists/* - -VOLUME /root/.cache/duplicity -VOLUME /backups -VOLUME /var/lock/duplicity - -ENV BACKUP_DEST="file:///backups" -ENV BACKUP_NAME="backup" -ENV PATH_TO_BACKUP="/data" -ENV PASSPHRASE="Correct.Horse.Battery.Staple" -ENV FLOCK_WAIT=60 - -# Cron schedules -ENV CRON_SCHEDULE="" -ENV FULL_CRON_SCHEDULE="" -ENV VERIFY_CRON_SCHEDULE="" - -# Create script dirs -RUN mkdir -p /scripts/backup/before -RUN mkdir -p /scripts/backup/after -RUN mkdir -p /scripts/restore/before -RUN mkdir -p /scripts/restore/after - -COPY backup.sh / -COPY restore.sh / -COPY start.sh / -COPY verify.sh / -COPY healthcheck.sh / -COPY cron-exec.sh / - -HEALTHCHECK CMD /healthcheck.sh - -CMD [ "/start.sh" ] diff --git a/Makefile b/Makefile index 326ecc0..8d948c4 100644 --- a/Makefile +++ b/Makefile @@ -1,48 +1,51 @@ DOCKER_TAG ?= docker-duplicity-cron .PHONY: default -default: build-x86 +default: build-amd64 + +.PHONY: all +all: build-all test-all test-s3-all .PHONY: test -test: test-x86 +test: test-amd64 -.PHONY: build-x86 -build-x86: - docker build -f ./Dockerfile -t $(DOCKER_TAG):ubuntu . +.PHONY: build-amd64 +build-amd64: + docker build --build-arg REPO=library -f ./Dockerfile -t $(DOCKER_TAG):amd64 . .PHONY: build-arm build-arm: - docker build -f ./Dockerfile.armhf -t $(DOCKER_TAG):raspbian . + docker build --build-arg REPO=arm32v7 -f ./Dockerfile -t $(DOCKER_TAG):arm . .PHONY: build-all -build-all: build-x86 build-arm +build-all: build-amd64 build-arm -.PHONY: test-x86 -test-x86: build-x86 - cd tests && ./test.sh $(DOCKER_TAG):ubuntu - cd tests && ./test-pre-scripts.sh $(DOCKER_TAG):ubuntu +.PHONY: test-amd64 +test-amd64: build-amd64 + cd tests && ./test.sh $(DOCKER_TAG):amd64 + cd tests && ./test-pre-scripts.sh $(DOCKER_TAG):amd64 .PHONY: test-arm test-arm: build-arm - cd tests && ./test.sh $(DOCKER_TAG):raspbian - cd tests && ./test-pre-scripts.sh $(DOCKER_TAG):raspbian + cd tests && ./test.sh $(DOCKER_TAG):arm + cd tests && ./test-pre-scripts.sh $(DOCKER_TAG):arm .PHONY: test-all -test-all: test-x86 test-arm +test-all: test-amd64 test-arm -.PHONY: test-s3-x86 -test-s3-x86: - cd tests && ./test-s3.sh Dockerfile +.PHONY: test-s3-amd64 +test-s3-amd64: build-amd64 + cd tests && ./test-s3.sh $(DOCKER_TAG):amd64 .PHONY: test-s3-arm -test-s3-arm: - cd tests && ./test-s3.sh Dockerfile.armhf +test-s3-arm: build-arm + cd tests && ./test-s3.sh $(DOCKER_TAG):arm .PHONY: test-s3-all -test-s3-all: test-s3-x86 test-s3-arm +test-s3-all: test-s3-amd64 test-s3-arm -.PHONY: shell-x86 -shell-x86: build-x86 +.PHONY: shell-amd64 +shell-amd64: build-amd64 docker run --rm -it $(DOCKER_TAG):ubuntu bash .PHONY: shell-arm @@ -50,7 +53,7 @@ shell-arm: build-arm docker run --rm -it $(DOCKER_TAG):raspbian bash .PHONY: shell -shell: shell-x86 +shell: shell-amd64 .PHONY: clean clean: diff --git a/tests/docker-compose-test-s3.yml b/tests/docker-compose-test-s3.yml index 33d6125..9af8f03 100644 --- a/tests/docker-compose-test-s3.yml +++ b/tests/docker-compose-test-s3.yml @@ -1,9 +1,13 @@ +--- version: '2' services: duplicity: - build: - context: .. - dockerfile: ${DOCKERFILE} + image: "$DOCKER_IMAGE" + # build: + # context: .. + # dockerfile: Dockerfile + # args: + # REPO: "${BUILD_ARG_REPO}" entrypoint: "bash" command: ["/test.sh"] hostname: itest diff --git a/tests/test-pre-scripts.sh b/tests/test-pre-scripts.sh index 8482406..1e0469d 100755 --- a/tests/test-pre-scripts.sh +++ b/tests/test-pre-scripts.sh @@ -1,7 +1,7 @@ #! /bin/bash set -e -image=$1 +image="$1" if [ "$IN_CONTAINER" != "true" ] ; then # Run the test script within the container @@ -10,7 +10,7 @@ if [ "$IN_CONTAINER" != "true" ] ; then -e SKIP_ON_START=true \ -v "$(pwd)/test-pre-scripts.sh:/test.sh" \ -v "$(pwd)/test-pre-scripts:/scripts" \ - $image \ + "$image" \ bash -c "/test.sh" else echo "Performing backup tests" diff --git a/tests/test-s3.sh b/tests/test-s3.sh index 7d056e5..957da2d 100755 --- a/tests/test-s3.sh +++ b/tests/test-s3.sh @@ -1,6 +1,5 @@ #! /bin/bash -export DOCKERFILE=$1 - +export DOCKER_IMAGE="$1" docker-compose -f docker-compose-test-s3.yml up \ --build --abort-on-container-exit --force-recreate diff --git a/tests/test.sh b/tests/test.sh index 3a77dc7..bc27db5 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,7 +1,7 @@ #! /bin/bash set -e -image=$1 +image="$1" if [ "$IN_CONTAINER" != "true" ] ; then # Run the test script within the container @@ -9,7 +9,7 @@ if [ "$IN_CONTAINER" != "true" ] ; then -e IN_CONTAINER=true \ -e SKIP_ON_START=true \ -v "$(pwd)/test.sh:/test.sh" \ - $image \ + "$image" \ bash -c "/test.sh" else echo "Performing backup tests"