Difference between revisions of "Dockerfile.isodb.vanilla"
From Cactus Howto
Jump to navigationJump to search(One intermediate revision by the same user not shown) | |||
Line 51: | Line 51: | ||
&& psql -d $ISODB -c "\copy text_msg (text_msg_id,text_msg_ger,text_msg_eng) FROM '$DATADIR/text_msg.csv' DELIMITER ';' CSV" \ |
&& psql -d $ISODB -c "\copy text_msg (text_msg_id,text_msg_ger,text_msg_eng) FROM '$DATADIR/text_msg.csv' DELIMITER ';' CSV" \ |
||
&& psql -d $ISODB -c "\i $SQLDIR/iso-fill-stm.sql" |
&& psql -d $ISODB -c "\i $SQLDIR/iso-fill-stm.sql" |
||
# Problem to solve: all objects belong to postgres owner and not itsecorg |
|||
# && psql -d $ISODB -c "\i $SAMPLEDIR/iso-fill-samples.sql" \ |
|||
# && psql -d $ISODB -c "\i $SAMPLEDIR/iso-user.sql" |
|||
EXPOSE 5432 |
EXPOSE 5432 |
||
Line 61: | Line 60: | ||
# Set the default command to run when starting the container |
# 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"] |
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$ |
|||
</pre> |
</pre> |
Latest revision as of 18:08, 20 December 2014
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`` COPY install /install USER postgres ENV ISODB isodb ENV SQLDIR /install/database/stored-procedures ENV DATADIR /install/database/csv-data RUN cat /install/database/conf/pg_hba.conf >> /etc/postgresql/9.3/main/pg_hba.conf RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf # && createlang -d $ISODB plpgsql && \ RUN /etc/init.d/postgresql start && psql -c "CREATE USER itsecorg WITH PASSWORD 'ixüpsz';" \ && createdb --owner itsecorg $ISODB && psql -d $ISODB -c "\i $SQLDIR/itsecorg-db-model.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-basic-procs.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-import.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-import-main.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-obj-import.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-obj-refs.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-svc-import.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-svc-refs.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-usr-import.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-usr-refs.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-rule-import.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-rule-refs.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-zone-import.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-report.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-report-basics.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-views-drop.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-views.sql" \ && psql -d $ISODB -c "\i $SQLDIR/iso-grants.sql" \ && psql -d $ISODB -c "\copy stm_color (color_name,color_rgb) FROM '$DATADIR/color.csv' DELIMITER ';' CSV" \ && psql -d $ISODB -c "\copy error (error_id,error_lvl,error_txt_ger,error_txt_eng) FROM '$DATADIR/error.csv' DELIMITER ';' CSV" \ && 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" \ && psql -d $ISODB -c "\copy text_msg (text_msg_id,text_msg_ger,text_msg_eng) FROM '$DATADIR/text_msg.csv' DELIMITER ';' CSV" \ && psql -d $ISODB -c "\i $SQLDIR/iso-fill-stm.sql" # Problem to solve: all objects belong to postgres owner and not itsecorg EXPOSE 5432 # 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"]