#!/bin/sh set -eu : "${BACKUP_FILE:?Set BACKUP_FILE to a PostgreSQL custom-format dump}" if [ ! -f "$BACKUP_FILE" ]; then printf '%s\n' "Backup file not found: $BACKUP_FILE" >&2 exit 1 fi if [ ! -s "$BACKUP_FILE" ]; then printf '%s\n' "Backup file is empty: $BACKUP_FILE" >&2 exit 1 fi docker compose -f compose.production.yaml run --rm -T postgres \ pg_restore --list < "$BACKUP_FILE" >/dev/null printf '%s\n' "Backup archive is readable: $BACKUP_FILE"