#!/bin/bash

RESTORE_DUMP_GZ=2023-09-06_aactdb_with_matches.sql.gz
POSTGRES_USER=root
POSTGRES_PASSWORD=root

#start container
podman run \
    -e POSTGRES_PASSWORD="${POSTGRES_PASSWORD}" \
    -e POSTGRES_USER="${POSTGRES_USER}" \
    -e POSTGRES_DB=aact_db \
    --name aact_db \
    --detatch \
    --shm-size=512mb \
    --volume ${RESTORE_DUMP_GZ}:/backup/${RESTORE_DUMP_GZ} \
    --ports 5432:5432\
    postgres:14-alpine



#execute within container
podman exec aact_db \
    "gzip --keep --stdout --decompress /backup/2023-09-06_aactdb_with_matches.sql.gz | psql -U ${POSTGRES_USER}"
