IMAGE postgres_12.5.0-210106
FROM alpine3.12_3.12.3-210106

RUN EOF
    # Create OS user (which will be picked up later by apk add)
    addgroup -S -g 5432 postgres
    adduser -S -u 5432 -h /var/lib/postgresql -s /bin/false -g postgres -G postgres postgres

    # Install PostgreSQL
    apk --no-cache add postgresql postgresql-contrib

    # Create socket directory 
    mkdir /run/postgresql
    chown postgres:postgres /run/postgresql
EOF

USER postgres
CMD /usr/bin/postgres -D /var/lib/postgresql
READY /usr/bin/pg_isready
