From dbt2-base ARG dbms=pgsql # Install DBT-2 PostgreSQL user defined C functions. WORKDIR /usr/local/src/dbt2/storedproc/pgsql/c RUN if [ "x$dbms" = "xpgsql" ]; then make USE_PGXS=1 install; fi RUN chmod 777 /opt USER postgres ENV DBT2DBNAME="dbt2" ENV DBT2PGDATA="/opt/pgdata" ARG warehouses=1 # Make sure we are in a directory we can write to. WORKDIR /home/postgres RUN if [ "x$dbms" = "xpgsql" ]; then \ dbt2-pgsql-build-db -u -p "-N 500" -s c -w $warehouses && \ dbt2-pgsql-stop-db && \ echo "host all all 0.0.0.0/0 trust" >> /opt/pgdata/pg_hba.conf && \ echo "host all all 0.0.0.0/0 trust" >> /opt/pgdata/pg_hba.conf && \ echo "host all all ::/0 trust" >> /opt/pgdata/pg_hba.conf && \ echo "DBT2DBNAME=dbt2" >> ~/.ssh/environment && \ echo "DBT2PGDATA=/opt/pgdata" >> ~/.ssh/environment && \ echo "listen_addresses = '*'" >> /opt/pgdata/postgresql.auto.conf && \ echo "max_connections = '500'" >> /opt/pgdata/postgresql.auto.conf; \ fi USER root RUN echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config RUN systemctl enable sshd CMD [ "/usr/sbin/init" ]