1
0
Fork 0
mirror of https://github.com/yavook/kiwi-backup.git synced 2024-11-21 22:43:01 +00:00
kiwi-backup/Dockerfile

109 lines
2.2 KiB
Docker
Raw Normal View History

FROM yavook/kiwi-cron:0.1 AS deps
2020-08-26 23:30:14 +00:00
LABEL maintainer="jmm@yavook.de"
RUN set -ex; \
2020-08-27 14:53:19 +00:00
\
# create backup source
mkdir -p /backup/source; \
2020-08-26 23:30:14 +00:00
\
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 \
python3 \
2020-08-26 23:30:14 +00:00
rsync \
; \
update-ca-certificates;
COPY requirements.txt /tmp/
RUN set -ex; \
2020-08-26 23:30:14 +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 \
git \
2020-08-26 23:30:14 +00:00
libffi-dev \
librsync-dev \
libxml2-dev \
libxslt-dev \
make \
musl-dev \
openssl-dev \
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
; \
\
# install duplicity
python3 -m pip --no-cache-dir \
install -r /tmp/requirements.txt \
2020-08-26 23:30:14 +00:00
; \
python3 -m pip --no-cache-dir \
install duplicity \
; \
2020-08-26 23:30:14 +00:00
\
# remove buildtime dependencies
python3 -m pip --no-cache-dir \
uninstall -y wheel \
; \
apk del --purge .build-deps; \
rm -rf "${USER}/.cargo";
2022-03-02 01:39:19 +00:00
# create non-root user
RUN adduser -D -u 1368 duplicity;
2020-08-26 23:30:14 +00:00
USER duplicity
RUN set -ex; \
\
2022-03-02 01:39:19 +00:00
mkdir -p "${HOME}/.cache/duplicity"; \
mkdir -pm 600 "${HOME}/.gnupg";
VOLUME [ "/home/duplicity/.cache/duplicity" ]
# confirm duplicity is working
RUN duplicity --version
2020-08-26 23:30:14 +00:00
ENV \
#################
# BACKUP POLICY #
#################
2020-08-28 01:22:05 +00:00
SCHEDULE_BACKUP="36 02 * * *" \
SCHEDULE_CLEANUP="36 04 * * *" \
2020-08-28 01:22:05 +00:00
FULL_BACKUP_FREQUENCY=3M \
BACKUP_RETENTION_TIME=6M \
KEEP_NUM_FULL_CHAINS=2 \
\
######################
# ADDITIONAL OPTIONS #
######################
SCHEDULE_RMFULL="36 05 * * SAT" \
SCHEDULE_RMINCR="36 05 * * SUN" \
BACKUP_VOLSIZE=1024 \
2020-08-28 01:22:05 +00:00
BACKUP_TARGET="file:///backup/target" \
OPTIONS_ALL="" \
OPTIONS_BACKUP="" \
OPTIONS_CLEANUP="" \
OPTIONS_RMFULL="" \
2020-08-27 14:53:19 +00:00
OPTIONS_RMINCR="" \
\
##############
# ENCRYPTION #
##############
GPG_KEY_ID="" \
GPG_PASSPHRASE=""
2020-08-26 23:30:14 +00:00
CMD ["do-plicity"]