Create an image for db backups

This commit is contained in:
Ajay
2022-05-17 01:29:49 -04:00
parent 901a42d1b4
commit dfbc32617b
5 changed files with 29 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
FROM alpine
RUN apk add postgresql-client
RUN apk add restic --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/
COPY ./backup.sh /usr/src/app/backup.sh
RUN chmod +x /usr/src/app/backup.sh
COPY ./backup.sh /usr/src/app/forget.sh
RUN chmod +x /usr/src/app/forget.sh
RUN echo '30 * * * * /usr/src/app/backup.sh' >> /etc/crontabs/root
RUN echo '10 0 * * 1 /usr/src/app/forget.sh' >> /etc/crontabs/root
CMD crond -l 2 -f

View File

@@ -0,0 +1,6 @@
mkdir ./dump
pg_dump -f ./dump/sponsorTimes.dump sponsorTimes
pg_dump -f ./dump/privateDB.dump privateDB
restic backup ./dump

View File

@@ -0,0 +1 @@
restic forget --prune --keep-last 48 --keep-daily 7 --keep-weekly 8

View File

@@ -0,0 +1,6 @@
FROM ghcr.io/ajayyy/sb-server:latest
EXPOSE 873/tcp
RUN apk add rsync>3.2.4-r0
RUN mkdir /usr/src/app/database-export
CMD rsync --no-detach --daemon & ./entrypoint.sh