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 | |
Zack Williams | 12031af | 2017-05-15 09:54:05 -0700 | [diff] [blame] | 7 | COPY postgres_apt_ACCC4CF8.asc /tmp/postgres_apt_ACCC4CF8.asc |
| 8 | RUN apt-key add /tmp/postgres_apt_ACCC4CF8.asc \ |
| 9 | && echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" \ |
| 10 | > /etc/apt/sources.list.d/pgdg.list \ |
| 11 | && DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --force-yes \ |
Zack Williams | a7fec78 | 2017-04-27 20:18:19 -0700 | [diff] [blame] | 12 | python-software-properties \ |
| 13 | software-properties-common \ |
Zack Williams | e0caa25 | 2017-04-30 21:20:20 -0700 | [diff] [blame] | 14 | postgresql-${PGSQL_VERSION} \ |
| 15 | postgresql-client-${PGSQL_VERSION} \ |
| 16 | postgresql-contrib-${PGSQL_VERSION} \ |
Zack Williams | a7fec78 | 2017-04-27 20:18:19 -0700 | [diff] [blame] | 17 | && rm -rf /var/lib/apt/lists/* |
| 18 | |
| 19 | # Workaround for AUFS issue |
| 20 | # https://github.com/docker/docker/issues/783#issuecomment-56013588 |
Zack Williams | 12031af | 2017-05-15 09:54:05 -0700 | [diff] [blame] | 21 | RUN mkdir /etc/ssl/private-copy \ |
| 22 | && mv /etc/ssl/private/* /etc/ssl/private-copy/ \ |
| 23 | && rm -r /etc/ssl/private \ |
| 24 | && mv /etc/ssl/private-copy /etc/ssl/private \ |
| 25 | && chmod -R 0700 /etc/ssl/private \ |
| 26 | && chown -R postgres /etc/ssl/private |
Zack Williams | a7fec78 | 2017-04-27 20:18:19 -0700 | [diff] [blame] | 27 | |
| 28 | USER postgres |
| 29 | |
| 30 | RUN /etc/init.d/postgresql start && \ |
| 31 | psql --command "ALTER USER postgres WITH SUPERUSER PASSWORD 'password' " && \ |
| 32 | psql --command "CREATE DATABASE xos" |
| 33 | |
Zack Williams | 12031af | 2017-05-15 09:54:05 -0700 | [diff] [blame] | 34 | # Allow remote connections |
| 35 | RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/${PGSQL_VERSION}/main/pg_hba.conf \ |
| 36 | && echo "host all all 0.0.0.0/0 password" >> /etc/postgresql/${PGSQL_VERSION}/main/pg_hba.conf \ |
| 37 | && echo "listen_addresses='*'" >> /etc/postgresql/${PGSQL_VERSION}/main/postgresql.conf |
Zack Williams | a7fec78 | 2017-04-27 20:18:19 -0700 | [diff] [blame] | 38 | |
| 39 | # Expose the PostgreSQL port |
| 40 | EXPOSE 5432 |
| 41 | |
| 42 | VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"] |
| 43 | |
Zack Williams | 52986b2 | 2017-04-19 16:28:25 -0700 | [diff] [blame] | 44 | # Label image |
| 45 | ARG org_label_schema_schema_version=1.0 |
| 46 | ARG org_label_schema_name=xos-postgres |
| 47 | ARG org_label_schema_version=unknown |
| 48 | ARG org_label_schema_vcs_url=unknown |
| 49 | ARG org_label_schema_vcs_ref=unknown |
| 50 | ARG org_label_schema_build_date=unknown |
| 51 | ARG org_opencord_vcs_commit_date=unknown |
| 52 | |
| 53 | LABEL org.label-schema.schema-version=$org_label_schema_schema_version \ |
| 54 | org.label-schema.name=$org_label_schema_name \ |
| 55 | org.label-schema.version=$org_label_schema_version \ |
| 56 | org.label-schema.vcs-url=$org_label_schema_vcs_url \ |
| 57 | org.label-schema.vcs-ref=$org_label_schema_vcs_ref \ |
| 58 | org.label-schema.build-date=$org_label_schema_build_date \ |
| 59 | org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 60 | |
Zack Williams | e0caa25 | 2017-04-30 21:20:20 -0700 | [diff] [blame] | 61 | 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 |