Skip to content

Commit 9161fcd

Browse files
authored
Merge pull request #7 from openimis/true_isready_script
Add script to detect that the DB is initializing
2 parents 9d99210 + 8d60ef7 commit 9161fcd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM postgres:13-alpine
22

3-
3+
# Script to detect whether the database has finished initializing
4+
COPY ["true_isready.sh", "/usr/local/bin/"]
45
COPY ["database scripts/00_dump.sql", "database scripts/0[2345]_*.sql", "database scripts/demo_db.sql", "/docker-entrypoint-initdb.d/"]

true_isready.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
if [[ $(pgrep -f docker-entrypoint-initdb.d) == "" ]]
3+
then
4+
exit 0
5+
else
6+
exit 1
7+
fi

0 commit comments

Comments
 (0)