Skip to content

Instantly share code, notes, and snippets.

@bfatemi
Created August 11, 2019 01:23
Show Gist options
  • Save bfatemi/f9e43c58d2196b6a7ecf6c3d2b1bf69a to your computer and use it in GitHub Desktop.
Save bfatemi/f9e43c58d2196b6a7ecf6c3d2b1bf69a to your computer and use it in GitHub Desktop.
##
## POSTGRES LITE DOCKERFILE- create db, user/pwd, and open listening
##
FROM postgres:11.1-alpine
ADD ./init.sh /docker-entrypoint-initdb.d/.
ENV PGDATA /var/lib/postgresql/data
EXPOSE 5432
USER postgres
RUN mkdir -p $PGDATA && chmod 0700 $PGDATA &&\
initdb \
--allow-group-access \
--encoding=UTF8 \
--pgdata=$PGDATA \
--auth=trust \
--auth-host=trust \
--auth-local=trust &&\
echo "host all all 0.0.0.0/0 md5" >> $PGDATA/pg_hba.conf &&\
echo "listen_addresses='*'" >> $PGDATA/postgresql.conf &&\
pg_ctl -D $PGDATA start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment