Zack Williams | 52986b2 | 2017-04-19 16:28:25 -0700 | [diff] [blame] | 1 | # xosproject/xos-postgres |
| 2 | FROM ubuntu:14.04.5 |
| 3 | |
| 4 | # Label image |
| 5 | ARG org_label_schema_schema_version=1.0 |
| 6 | ARG org_label_schema_name=xos-postgres |
| 7 | ARG org_label_schema_version=unknown |
| 8 | ARG org_label_schema_vcs_url=unknown |
| 9 | ARG org_label_schema_vcs_ref=unknown |
| 10 | ARG org_label_schema_build_date=unknown |
| 11 | ARG org_opencord_vcs_commit_date=unknown |
| 12 | |
| 13 | LABEL org.label-schema.schema-version=$org_label_schema_schema_version \ |
| 14 | org.label-schema.name=$org_label_schema_name \ |
| 15 | org.label-schema.version=$org_label_schema_version \ |
| 16 | org.label-schema.vcs-url=$org_label_schema_vcs_url \ |
| 17 | org.label-schema.vcs-ref=$org_label_schema_vcs_ref \ |
| 18 | org.label-schema.build-date=$org_label_schema_build_date \ |
| 19 | org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 20 | |
| 21 | RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 |
| 22 | |
| 23 | RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list |
| 24 | |
| 25 | RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --force-yes\ |
| 26 | python-software-properties \ |
| 27 | software-properties-common \ |
| 28 | postgresql-9.3 \ |
| 29 | postgresql-client-9.3 \ |
| 30 | postgresql-contrib-9.3 |
| 31 | |
Tony Mack | 01c8c48 | 2015-10-29 21:56:02 +0000 | [diff] [blame] | 32 | # Workaround for AUFS issue |
| 33 | # https://github.com/docker/docker/issues/783#issuecomment-56013588 |
| 34 | RUN mkdir /etc/ssl/private-copy; mv /etc/ssl/private/* /etc/ssl/private-copy/; rm -r /etc/ssl/private; mv /etc/ssl/private-copy /etc/ssl/private; chmod -R 0700 /etc/ssl/private; chown -R postgres /etc/ssl/private |
| 35 | |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 36 | USER postgres |
| 37 | |
| 38 | RUN /etc/init.d/postgresql start && \ |
Tony Mack | bf0271c | 2015-10-31 00:17:44 +0000 | [diff] [blame] | 39 | psql --command "ALTER USER postgres WITH SUPERUSER PASSWORD 'password' " && \ |
| 40 | psql --command "CREATE DATABASE xos" |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 41 | |
| 42 | # Allow remote connections. |
| 43 | RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf |
Tony Mack | bf484a6 | 2015-10-30 21:51:04 +0000 | [diff] [blame] | 44 | RUN echo "host all all 0.0.0.0/0 password" >> /etc/postgresql/9.3/main/pg_hba.conf |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 45 | |
| 46 | RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf |
| 47 | |
| 48 | # Expose the PostgreSQL port |
| 49 | EXPOSE 5432 |
| 50 | |
| 51 | VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"] |
| 52 | |
| 53 | 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"] |