Skip to content

Instantly share code, notes, and snippets.

@gongo gongo/Dockerfile
Last active Aug 29, 2015

Embed
What would you like to do?
FROM postgres:9.4
ENV PGDATA /pgdata
COPY test.sql /docker-entrypoint-initdb.d/
COPY restore.sh /restore.sh
RUN /restore.sh
FROM postgres:9.4
ENV PGDATA /pgdata
COPY test.sql /docker-entrypoint-initdb.d/
RUN /docker-entrypoint.sh postgres
#!/bin/bash
PIPEFILE="pipefile"
ENTRY_PID=""
[[ -p "$PIPEFILE" ]] || mkfifo "$PIPEFILE"
/docker-entrypoint.sh postgres > "$PIPEFILE" & ENTRY_PID="$!"
while read LINE ; do
echo $LINE
if [[ "$LINE" == *"ready for start up"* ]] ; then
sleep 3
break
fi
done < "$PIPEFILE"
kill -s TERM "$ENTRY_PID" && wait "$ENTRY_PID"
CREATE DATABASE gongo;
\c gongo;
CREATE TABLE users (
name text,
age integer
);
INSERT INTO users (name, age) VALUES ('gongo', 999), ('du', 666);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.