fix: open repository on container entry
This commit is contained in:
parent
c887b11391
commit
73281c75b5
3 changed files with 16 additions and 7 deletions
|
@ -6,6 +6,15 @@ RUN apt-get update && apt-get install -y cron && rm -rf /var/lib/apt/lists/*
|
||||||
ARG KOPIA_CRON_SCHEDULE="*/30 * * * *"
|
ARG KOPIA_CRON_SCHEDULE="*/30 * * * *"
|
||||||
ENV KOPIA_CRON_SCHEDULE ${KOPIA_CRON_SCHEDULE}
|
ENV KOPIA_CRON_SCHEDULE ${KOPIA_CRON_SCHEDULE}
|
||||||
|
|
||||||
|
ARG KOPIA_USERNAME
|
||||||
|
ENV KOPIA_USERNAME ${KOPIA_USERNAME}
|
||||||
|
|
||||||
|
ARG KOPIA_HOSTNAME
|
||||||
|
ENV KOPIA_HOSTNAME ${KOPIA_HOSTNAME}
|
||||||
|
|
||||||
|
ARG KOPIA_PASSWORD
|
||||||
|
ENV KOPIA_PASSWORD ${KOPIA_PASSWORD}
|
||||||
|
|
||||||
ADD run-backup.sh /
|
ADD run-backup.sh /
|
||||||
ADD entrypoint.sh /
|
ADD entrypoint.sh /
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
CRONTAB=/etc/cron.d/kopia-backup
|
CRONTAB=/etc/cron.d/kopia-backup
|
||||||
|
|
||||||
|
echo "Opening kopia repository"
|
||||||
|
|
||||||
|
kopia repository connect filesystem \
|
||||||
|
--path /repository \
|
||||||
|
--override-hostname ${KOPIA_HOSTNAME} \
|
||||||
|
--override-username ${KOPIA_USERNAME}
|
||||||
|
|
||||||
echo "Running cron with schedule ${KOPIA_CRON_SCHEDULE}"
|
echo "Running cron with schedule ${KOPIA_CRON_SCHEDULE}"
|
||||||
|
|
||||||
echo "${KOPIA_CRON_SCHEDULE} /run-backup.sh > /var/log/kopia-backup.log 2>&1" > ${CRONTAB}
|
echo "${KOPIA_CRON_SCHEDULE} /run-backup.sh > /var/log/kopia-backup.log 2>&1" > ${CRONTAB}
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
kopia --version
|
|
||||||
|
|
||||||
kopia repository connect filesystem \
|
|
||||||
--path /repository \
|
|
||||||
--override-hostname ${KOPIA_HOSTNAME} \
|
|
||||||
--override-username ${KOPIA_USERNAME}
|
|
||||||
|
|
||||||
kopia snapshot create /backup
|
kopia snapshot create /backup
|
||||||
|
|
Loading…
Reference in a new issue