diff --git a/Makefile b/Makefile index 5a11f8a28ba091f1e1640a730f90f34e32611ef7..be68b105a65284f30a3743ec35d578d7aaf0ce8c 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,6 @@ cache: # Build DB image db: docker build --no-cache -t ssa-containers.aoc.nrao.edu/ops/ci/db:workspaces -f ./ci/psql/Dockerfile.db . - docker build --no-cache -t ssa-containers.aoc.nrao.edu/ops/ci/db-ngas:workspaces -f ./ci/psql/Dockerfile.db-ngas . # Build docker images build: docker-base db cache diff --git a/ci/psql/init_ngas_db.sh b/ci/psql/init_ngas_db.sh index a2fe596887afdab5f0f81329992aef9266aafdb5..6157a5b6732b006242a066fb85015398b40a87af 100755 --- a/ci/psql/init_ngas_db.sh +++ b/ci/psql/init_ngas_db.sh @@ -7,12 +7,9 @@ DB=ngas PATH_TO_SQL_FILE=/repos/ngas/src/ngamsCore/ngamsSql/ngamsCreateTables-PostgreSQL.sql echo "Creating database '$DB' " +createdb -U $POSTGRES_USER -O $POSTGRES_USER $DB -psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL - CREATE DATABASE $DB; - GRANT ALL PRIVILEGES ON DATABASE $DB TO archive; -EOSQL +echo "Populating database '$DB' " +psql -U $POSTGRES_USER -1 -d $DB -f $PATH_TO_SQL_FILE -psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname $DB < $PATH_TO_SQL_FILE - -echo "'$DB' was created successfully" +echo "'$DB' was created and populated successfully"