mirror of
https://github.com/ViViDboarder/docker-duplicity-cron.git
synced 2024-11-22 12:36:28 +00:00
Simplify multi-arch building
Rather than having multiple Dockerfiles, switch to a single Dockerfile and a build arg.
This commit is contained in:
parent
cb86cd531f
commit
5794cd86e1
@ -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
|
||||
|
@ -1,5 +1,6 @@
|
||||
FROM ubuntu:xenial
|
||||
MAINTAINER ViViDboarder <vividboarder@gmail.com>
|
||||
ARG REPO=library
|
||||
FROM ${REPO}/ubuntu:xenial
|
||||
LABEL maintainer="ViViDboarder <vividboarder@gmail.com>"
|
||||
|
||||
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/*
|
||||
|
||||
|
@ -1,57 +0,0 @@
|
||||
FROM raspbian/jessie
|
||||
MAINTAINER ViViDboarder <vividboarder@gmail.com>
|
||||
|
||||
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" ]
|
49
Makefile
49
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:
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user