update db-seed
This commit is contained in:
10
db-seed/Dockerfile
Normal file
10
db-seed/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM postgres:16
|
||||
|
||||
WORKDIR /seed
|
||||
|
||||
COPY equipment-import.sql /seed/equipment-import.sql
|
||||
COPY db-seed/import.sh /seed/import.sh
|
||||
|
||||
RUN chmod +x /seed/import.sh
|
||||
|
||||
CMD ["/seed/import.sh"]
|
||||
13
db-seed/import.sh
Normal file
13
db-seed/import.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${POSTGRES_USER:=postgres}"
|
||||
: "${POSTGRES_DB:=toir}"
|
||||
: "${PGPASSWORD:=change-me}"
|
||||
|
||||
until pg_isready -h postgres -U "$POSTGRES_USER" -d "$POSTGRES_DB" >/dev/null 2>&1; do
|
||||
echo "waiting for postgres..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
psql -h postgres -U "$POSTGRES_USER" -d "$POSTGRES_DB" -v ON_ERROR_STOP=1 -f /seed/equipment-import.sql
|
||||
Reference in New Issue
Block a user