blob: b10d85384674e1a67fc37b99a9822ad318d1fdda [file] [log] [blame]
Zack Williams52986b22017-04-19 16:28:25 -07001# xosproject/xos-postgres
2FROM ubuntu:14.04.5
3
Zack Williamsa7fec782017-04-27 20:18:19 -07004# Version of PostgreSQL to install
5ENV PGSQL_VERSION 9.6
6
Zack Williams12031af2017-05-15 09:54:05 -07007COPY postgres_apt_ACCC4CF8.asc /tmp/postgres_apt_ACCC4CF8.asc
8RUN 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 Williamsa7fec782017-04-27 20:18:19 -070012 python-software-properties \
13 software-properties-common \
Zack Williamse0caa252017-04-30 21:20:20 -070014 postgresql-${PGSQL_VERSION} \
15 postgresql-client-${PGSQL_VERSION} \
16 postgresql-contrib-${PGSQL_VERSION} \
Zack Williamsa7fec782017-04-27 20:18:19 -070017 && rm -rf /var/lib/apt/lists/*
18
19# Workaround for AUFS issue
20# https://github.com/docker/docker/issues/783#issuecomment-56013588
Zack Williams12031af2017-05-15 09:54:05 -070021RUN 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 Williamsa7fec782017-04-27 20:18:19 -070027
28USER postgres
29
30RUN /etc/init.d/postgresql start && \
31 psql --command "ALTER USER postgres WITH SUPERUSER PASSWORD 'password' " && \
32 psql --command "CREATE DATABASE xos"
33
Zack Williams12031af2017-05-15 09:54:05 -070034# Allow remote connections
35RUN 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 Williamsa7fec782017-04-27 20:18:19 -070038
39# Expose the PostgreSQL port
40EXPOSE 5432
41
42VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
43
Zack Williams52986b22017-04-19 16:28:25 -070044# Label image
45ARG org_label_schema_schema_version=1.0
46ARG org_label_schema_name=xos-postgres
47ARG org_label_schema_version=unknown
48ARG org_label_schema_vcs_url=unknown
49ARG org_label_schema_vcs_ref=unknown
50ARG org_label_schema_build_date=unknown
51ARG org_opencord_vcs_commit_date=unknown
52
53LABEL 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 Mack7ca8c522015-10-29 21:14:41 +000060
Zack Williamse0caa252017-04-30 21:20:20 -070061CMD /usr/lib/postgresql/${PGSQL_VERSION}/bin/postgres -D /var/lib/postgresql/${PGSQL_VERSION}/main -c config_file=/etc/postgresql/${PGSQL_VERSION}/main/postgresql.conf