File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 16
16
17
17
set -eu
18
18
IMPORT_FILE=$1
19
+
20
+ POSTGRES_IMAGE=" postgres:16.3-alpine"
21
+
19
22
docker rm -f spi_dev
20
- docker run --name spi_dev -e POSTGRES_DB=spi_dev -e POSTGRES_USER=spi_dev -e POSTGRES_PASSWORD=xxx -p 6432:5432 -d postgres:16.3-alpine
23
+ docker run --name spi_dev -e POSTGRES_DB=spi_dev -e POSTGRES_USER=spi_dev -e POSTGRES_PASSWORD=xxx -p 6432:5432 -d $POSTGRES_IMAGE
21
24
echo " Giving Postgres a moment to launch ..."
22
25
sleep 5
26
+
23
27
echo " Creating Azure roles"
24
- PGPASSWORD=xxx psql -h " ${HOST:- localhost} " -p 6432 -U spi_dev -d spi_dev -c ' CREATE ROLE azure_pg_admin; CREATE ROLE azuresu;'
28
+ psql=" docker run --rm -v $PWD :/host -w /host --network=host -e PGPASSWORD=xxx $POSTGRES_IMAGE psql"
29
+ $psql -h " ${HOST:- localhost} " -p 6432 -U spi_dev -d spi_dev -c ' CREATE ROLE azure_pg_admin; CREATE ROLE azuresu;'
30
+
25
31
echo " Importing"
26
- PGPASSWORD=xxx pg_restore --no-owner -h " ${HOST:- localhost} " -p 6432 -U spi_dev -d spi_dev < " $IMPORT_FILE "
32
+ pg_restore=" docker run --rm -i -v $PWD :/host -w /host --network=host -e PGPASSWORD=xxx $POSTGRES_IMAGE pg_restore"
33
+ $pg_restore --no-owner -h " ${HOST:- localhost} " -p 6432 -U spi_dev -d spi_dev < " $IMPORT_FILE "
You can’t perform that action at this time.
0 commit comments