Skip to content

Commit 2e51ce8

Browse files
axonasifsagor999
authored andcommitted
fix(tool-postgresql): Race condition
1 parent 72f19c9 commit 2e51ce8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

chunks/tool-postgresql/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ RUN PGDATA="${PGDATA//\/workspace/$HOME}" \
2020
&& printf '#!/bin/bash\npg_ctl -D $PGDATA -l ~/.pg_ctl/log -o "-k ~/.pg_ctl/sockets" stop\n' > ~/.pg_ctl/bin/pg_stop \
2121
&& chmod +x ~/.pg_ctl/bin/* \
2222
&& printf '%s\n' '# Auto-start PostgreSQL server' \
23-
"test ! -e \$PGWORKSPACE && test -e ${PGDATA%/data} && mv ${PGDATA%/data} /workspace" \
24-
'[[ $(pg_ctl status | grep PID) ]] || pg_start > /dev/null' > ~/.bashrc.d/200-postgresql-launch
23+
'(' \
24+
"mkdir \$PGWORKSPACE 2>/dev/null || exit 0; test -e ${PGDATA%/data} && mv ${PGDATA%/data} /workspace" \
25+
'[[ $(pg_ctl status | grep PID) ]] || pg_start > /dev/null' \
26+
') & disown' > ~/.bashrc.d/200-postgresql-launch
2527
ENV PATH="$HOME/.pg_ctl/bin:$PATH"
2628
ENV DATABASE_URL="postgresql://gitpod@localhost"
2729
ENV PGHOSTADDR="127.0.0.1"

0 commit comments

Comments
 (0)