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