2022-03-02 23:42:11 +00:00
|
|
|
FROM yavook/kiwi-cron:0.2
|
2020-08-26 23:30:14 +00:00
|
|
|
LABEL maintainer="jmm@yavook.de"
|
|
|
|
|
2022-03-02 16:30:22 +00:00
|
|
|
COPY requirements.txt /tmp/
|
|
|
|
|
2022-03-02 23:42:11 +00:00
|
|
|
# full install of duplicity distribution
|
2020-08-26 23:30:14 +00:00
|
|
|
RUN set -ex; \
|
|
|
|
\
|
2022-03-02 16:30:22 +00:00
|
|
|
# duplicity software dependencies
|
2021-09-21 16:39:14 +00:00
|
|
|
apk --no-cache add \
|
2020-08-26 23:30:14 +00:00
|
|
|
ca-certificates \
|
|
|
|
gettext \
|
|
|
|
gnupg \
|
|
|
|
lftp \
|
|
|
|
libffi \
|
|
|
|
librsync \
|
|
|
|
libxml2 \
|
|
|
|
libxslt \
|
2021-09-21 16:39:14 +00:00
|
|
|
openssh-client \
|
2020-08-26 23:30:14 +00:00
|
|
|
openssl \
|
2022-03-02 00:11:13 +00:00
|
|
|
python3 \
|
2020-08-26 23:30:14 +00:00
|
|
|
rsync \
|
|
|
|
; \
|
2022-03-02 16:30:22 +00:00
|
|
|
update-ca-certificates; \
|
2020-08-26 23:30:14 +00:00
|
|
|
\
|
2022-03-02 00:11:13 +00:00
|
|
|
# python packages buildtime dependencies
|
2021-09-21 16:39:14 +00:00
|
|
|
apk --no-cache add --virtual .build-deps \
|
2020-08-26 23:30:14 +00:00
|
|
|
gcc \
|
2022-03-02 00:11:13 +00:00
|
|
|
git \
|
2020-08-26 23:30:14 +00:00
|
|
|
libffi-dev \
|
|
|
|
librsync-dev \
|
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
|
|
|
make \
|
|
|
|
musl-dev \
|
|
|
|
openssl-dev \
|
2022-03-02 00:11:13 +00:00
|
|
|
python3-dev \
|
|
|
|
py3-pip \
|
|
|
|
cargo \
|
|
|
|
; \
|
|
|
|
# make use of prebuilt wheels where possible
|
|
|
|
python3 -m pip --no-cache-dir \
|
|
|
|
install wheel \
|
2020-08-26 23:30:14 +00:00
|
|
|
; \
|
|
|
|
\
|
2022-03-02 01:26:13 +00:00
|
|
|
# install duplicity
|
2022-03-02 00:11:13 +00:00
|
|
|
python3 -m pip --no-cache-dir \
|
|
|
|
install -r /tmp/requirements.txt \
|
2020-08-26 23:30:14 +00:00
|
|
|
; \
|
2022-03-02 01:26:13 +00:00
|
|
|
python3 -m pip --no-cache-dir \
|
|
|
|
install duplicity \
|
|
|
|
; \
|
2020-08-26 23:30:14 +00:00
|
|
|
\
|
2022-03-02 23:42:11 +00:00
|
|
|
# cleanup
|
2022-03-02 00:11:13 +00:00
|
|
|
python3 -m pip --no-cache-dir \
|
|
|
|
uninstall -y wheel \
|
|
|
|
; \
|
2022-03-02 01:26:13 +00:00
|
|
|
apk del --purge .build-deps; \
|
2022-03-02 01:56:44 +00:00
|
|
|
rm -f "/tmp/requirements.txt"; \
|
2022-03-02 17:41:47 +00:00
|
|
|
rm -rf "${HOME}/.cargo";
|
|
|
|
|
2022-03-02 23:42:11 +00:00
|
|
|
# start of kiwi additions here
|
2022-03-02 17:41:47 +00:00
|
|
|
RUN set -ex; \
|
|
|
|
\
|
2022-03-02 23:42:11 +00:00
|
|
|
# create /kiwi-backup directory structure
|
2022-03-02 17:41:47 +00:00
|
|
|
mkdir -m 777 /kiwi-backup; \
|
|
|
|
mkdir -m 777 /kiwi-backup/source; \
|
|
|
|
mkdir -m 777 /kiwi-backup/target; \
|
2022-03-02 16:30:22 +00:00
|
|
|
\
|
2022-03-02 23:42:11 +00:00
|
|
|
# we need to run as root in container.
|
|
|
|
# otherwise, we might miss directories in backup source!
|
|
|
|
mkdir -p "/root/.cache/duplicity"; \
|
|
|
|
mkdir -pm 700 "/root/.gnupg"; \
|
2022-03-02 17:41:47 +00:00
|
|
|
\
|
|
|
|
# confirm duplicity is working
|
|
|
|
duplicity --version;
|
2022-03-02 01:39:19 +00:00
|
|
|
|
2022-03-02 23:42:11 +00:00
|
|
|
VOLUME [ "/root/.cache/duplicity" ]
|
2022-03-02 01:39:19 +00:00
|
|
|
|
2020-08-27 13:57:36 +00:00
|
|
|
ENV \
|
|
|
|
#################
|
|
|
|
# BACKUP POLICY #
|
|
|
|
#################
|
2022-03-02 23:42:11 +00:00
|
|
|
SCHEDULE_BACKUP="R 02 * * *" \
|
|
|
|
SCHEDULE_CLEANUP="R 04 * * *" \
|
2020-08-28 01:22:05 +00:00
|
|
|
FULL_BACKUP_FREQUENCY=3M \
|
|
|
|
BACKUP_RETENTION_TIME=6M \
|
|
|
|
KEEP_NUM_FULL_CHAINS=2 \
|
2020-08-27 13:57:36 +00:00
|
|
|
\
|
|
|
|
######################
|
|
|
|
# ADDITIONAL OPTIONS #
|
|
|
|
######################
|
2022-03-02 23:42:11 +00:00
|
|
|
SCHEDULE_RMFULL="R 05 * * SAT" \
|
|
|
|
SCHEDULE_RMINCR="R 05 * * SUN" \
|
2020-08-27 13:57:36 +00:00
|
|
|
BACKUP_VOLSIZE=1024 \
|
2022-03-02 17:41:47 +00:00
|
|
|
BACKUP_SOURCE="/kiwi-backup/source" \
|
|
|
|
BACKUP_TARGET="file:///kiwi-backup/target" \
|
2020-09-23 12:58:14 +00:00
|
|
|
OPTIONS_ALL="" \
|
2020-08-27 13:57:36 +00:00
|
|
|
OPTIONS_BACKUP="" \
|
|
|
|
OPTIONS_CLEANUP="" \
|
|
|
|
OPTIONS_RMFULL="" \
|
2020-08-27 14:53:19 +00:00
|
|
|
OPTIONS_RMINCR="" \
|
|
|
|
\
|
|
|
|
##############
|
|
|
|
# ENCRYPTION #
|
|
|
|
##############
|
|
|
|
GPG_KEY_ID="" \
|
|
|
|
GPG_PASSPHRASE=""
|
2020-08-27 13:57:36 +00:00
|
|
|
|
2022-03-02 16:30:22 +00:00
|
|
|
COPY bin /usr/local/bin/
|
|
|
|
COPY libexec /usr/local/libexec/
|
2022-03-02 17:41:47 +00:00
|
|
|
|
|
|
|
CMD [ "kiwi-backup" ]
|