FROM debian

ADD . .

RUN apt -y update
RUN apt -y install postgresql

RUN sed -i '1i local all urlshorteneruser trust\nhost all all 0.0.0.0/0 md5\nhost all all ::/0 md5' /etc/postgresql/11/main/pg_hba.conf

RUN pg_ctlcluster 11 main start && su -c 'psql -f 0_runAllScripts.sql' postgres

CMD ["./docker.sh"]
