git init
This commit is contained in:
9
db-seed/Dockerfile
Normal file
9
db-seed/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
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"]
|
||||
16
db-seed/import.sh
Normal file
16
db-seed/import.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
export PGPASSWORD="${POSTGRES_PASSWORD:-postgres}"
|
||||
|
||||
until pg_isready -h "${POSTGRES_HOST:-postgres}" -U "${POSTGRES_USER:-postgres}" -d "${POSTGRES_DB:-toir}"; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
if [ -f /seed/equipment-import.sql ]; then
|
||||
psql \
|
||||
-h "${POSTGRES_HOST:-postgres}" \
|
||||
-U "${POSTGRES_USER:-postgres}" \
|
||||
-d "${POSTGRES_DB:-toir}" \
|
||||
-f /seed/equipment-import.sql
|
||||
fi
|
||||
Reference in New Issue
Block a user