FROM alpine:3
ENV LISTEN_PORT=5432
ENV SOCKET_PATH=/var/run/postgresql/.s.PGSQL.5432
RUN apk add --no-cache socat
USER nobody
CMD ["/bin/sh", "-c", "/usr/bin/socat \"tcp-listen:$LISTEN_PORT,reuseaddr,fork\" \"unix-client:$SOCKET_PATH\""]