From 7adba5a4abcd6b0907dffa77ac297930567a7af7 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Fri, 18 Aug 2023 21:19:37 +0200 Subject: [PATCH] feat: add postgresql-client --- Dockerfile | 2 +- run-backup.sh | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4ef6a28..de835e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM kopia/kopia ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y cron && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y cron postgresql-client && rm -rf /var/lib/apt/lists/* ARG KOPIA_CRON_SCHEDULE ENV KOPIA_CRON_SCHEDULE ${KOPIA_CRON_SCHEDULE} diff --git a/run-backup.sh b/run-backup.sh index 95c05c8..8093c1c 100755 --- a/run-backup.sh +++ b/run-backup.sh @@ -1,4 +1,9 @@ -#!/bin/sh +#!/bin/bash + +if [[ -v KOPIA_PG_DATABASE ]]; +then + PGPASSWORD=$KOPIA_PG_PASSWORD pg_dump --host=$KOPIA_PG_HOST --username=$KOPIA_PG_USER $KOPIA_PG_DATABASE > /backup/database/$KOPIA_PG_DATABASE.sqldump || exit 1 +fi kopia repository connect filesystem \ --path /repository \