blob: 68cd4ad64419f805d3df96623166cceec02d181e [file] [log] [blame]
Zack Williams52986b22017-04-19 16:28:25 -07001# xosproject/xos-postgres
2FROM ubuntu:14.04.5
3
4# Label image
5ARG org_label_schema_schema_version=1.0
6ARG org_label_schema_name=xos-postgres
7ARG org_label_schema_version=unknown
8ARG org_label_schema_vcs_url=unknown
9ARG org_label_schema_vcs_ref=unknown
10ARG org_label_schema_build_date=unknown
11ARG org_opencord_vcs_commit_date=unknown
12
13LABEL 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 Mack7ca8c522015-10-29 21:14:41 +000020
21RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
22
23RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
24
25RUN 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 Mack01c8c482015-10-29 21:56:02 +000032# Workaround for AUFS issue
33# https://github.com/docker/docker/issues/783#issuecomment-56013588
34RUN 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 Mack7ca8c522015-10-29 21:14:41 +000036USER postgres
37
38RUN /etc/init.d/postgresql start && \
Tony Mackbf0271c2015-10-31 00:17:44 +000039 psql --command "ALTER USER postgres WITH SUPERUSER PASSWORD 'password' " && \
40 psql --command "CREATE DATABASE xos"
Tony Mack7ca8c522015-10-29 21:14:41 +000041
42# Allow remote connections.
43RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf
Tony Mackbf484a62015-10-30 21:51:04 +000044RUN echo "host all all 0.0.0.0/0 password" >> /etc/postgresql/9.3/main/pg_hba.conf
Tony Mack7ca8c522015-10-29 21:14:41 +000045
46RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf
47
48# Expose the PostgreSQL port
49EXPOSE 5432
50
51VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
52
53CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"]