This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${BACKUP_FILE:?Set BACKUP_FILE to a PostgreSQL custom-format dump}"
|
||||
: "${POSTGRES_DB:?Set POSTGRES_DB}"
|
||||
: "${POSTGRES_USER:?Set POSTGRES_USER}"
|
||||
: "${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}"
|
||||
|
||||
if [ ! -f "$BACKUP_FILE" ]; then
|
||||
printf '%s\n' "Backup file not found: $BACKUP_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker compose -f compose.production.yaml exec -T \
|
||||
-e PGPASSWORD="$POSTGRES_PASSWORD" postgres \
|
||||
pg_restore --clean --if-exists --no-owner -U "$POSTGRES_USER" -d "$POSTGRES_DB" < "$BACKUP_FILE"
|
||||
Reference in New Issue
Block a user