Dockerfile.isodb.vanilla
From Cactus Howto
Jump to navigationJump to search
FROM ubuntu:14.04.1 MAINTAINER itsecorg@cactus.de # Add the PostgreSQL PGP key to verify their Debian packages. # It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc #RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 # Add PostgreSQL's repository. It contains the most recent stable release of PostgreSQL, 9.3. #RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list # Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 9.3 # There are some warnings (in red) that show up during the build. You can hide # them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive #RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 RUN apt-get update && apt-get install -y postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 # Run the rest of the commands as the ``postgres`` user created by the ``postgres-9.3`` package when it was ``apt-get installed`` USER postgres ENV ISODB isodb ENV SQLDIR /install/database/stored-procedures ENV DATADIR /install/database/csv-data RUN /etc/init.d/postgresql start && psql -c "CREATE USER itsecorg WITH PASSWORD 'st8chel';" && createdb --owner itsecorg $ISODB COPY install /install RUN cat /install/database/conf/pg_hba.conf >> /etc/postgresql/9.3/main/pg_hba.conf RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf EXPOSE 5432 #RUN createlang -d $ISODB plpgsql #RUN psql -d $ISODB -c "\i $SQLDIR/itsecorg-db-model.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-basic-procs.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-import.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-import-main.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-obj-import.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-obj-refs.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-svc-import.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-svc-refs.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-usr-import.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-usr-refs.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-rule-import.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-rule-refs.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-zone-import.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-report.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-report-basics.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-views-drop.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-views.sql" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-grants.sql" # #RUN psql -d $ISODB -c "\copy stm_color (color_name,color_rgb) FROM '$DATADIR/color.csv' DELIMITER ';' CSV" #RUN psql -d $ISODB -c "\copy error (error_id,error_lvl,error_txt_ger,error_txt_eng) FROM '$DATADIR/error.csv' DELIMITER ';' CSV" #RUN psql -d $ISODB -c "\copy stm_ip_proto (ip_proto_id,ip_proto_name,ip_proto_comment) FROM '$DATADIR/ip-protocol-list.csv' DELIMITER ';' CSV" #RUN psql -d $ISODB -c "\copy text_msg (text_msg_id,text_msg_ger,text_msg_eng) FROM '$DATADIR/text_msg.csv' DELIMITER ';' CSV" #RUN psql -d $ISODB -c "\i $SQLDIR/iso-fill-stm.sql" #RUN psql -d $ISODB -c "\i $SAMPLEDIR/iso-fill-samples.sql" #RUN psql -d $ISODB -c "\i $SAMPLEDIR/iso-user.sql" # Add VOLUMEs to allow backup of config, logs and databases VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"] # Set the default command to run when starting the container CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"] tim@ubuntu:~/docker/isodb$