include postgresql apt GPG key in repo, cleanup
whitespace fix

Change-Id: I4f789c99c1736cc949b706161e21293e4b61a59d
diff --git a/containers/postgresql/Dockerfile b/containers/postgresql/Dockerfile
index 7ce6421..b10d853 100644
--- a/containers/postgresql/Dockerfile
+++ b/containers/postgresql/Dockerfile
@@ -4,12 +4,11 @@
 # Version of PostgreSQL to install
 ENV PGSQL_VERSION 9.6
 
-RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
-
-RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" \
-    > /etc/apt/sources.list.d/pgdg.list
-
-RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --force-yes\
+COPY postgres_apt_ACCC4CF8.asc /tmp/postgres_apt_ACCC4CF8.asc
+RUN apt-key add /tmp/postgres_apt_ACCC4CF8.asc \
+ && echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" \
+    > /etc/apt/sources.list.d/pgdg.list \
+ && DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --force-yes \
     python-software-properties \
     software-properties-common \
     postgresql-${PGSQL_VERSION} \
@@ -19,7 +18,12 @@
 
 # Workaround for AUFS issue
 # https://github.com/docker/docker/issues/783#issuecomment-56013588
-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
+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
 
 USER postgres
 
@@ -27,11 +31,10 @@
     psql --command "ALTER USER postgres WITH SUPERUSER PASSWORD 'password' " && \
     psql --command "CREATE DATABASE xos"
 
-# Allow remote connections.
-RUN echo "host all  all    0.0.0.0/0  md5" >> /etc/postgresql/${PGSQL_VERSION}/main/pg_hba.conf
-RUN echo "host all  all    0.0.0.0/0  password" >> /etc/postgresql/${PGSQL_VERSION}/main/pg_hba.conf
-
-RUN echo "listen_addresses='*'" >> /etc/postgresql/${PGSQL_VERSION}/main/postgresql.conf
+# Allow remote connections
+RUN echo "host all  all    0.0.0.0/0  md5" >> /etc/postgresql/${PGSQL_VERSION}/main/pg_hba.conf \
+ && echo "host all  all    0.0.0.0/0  password" >> /etc/postgresql/${PGSQL_VERSION}/main/pg_hba.conf \
+ && echo "listen_addresses='*'" >> /etc/postgresql/${PGSQL_VERSION}/main/postgresql.conf
 
 # Expose the PostgreSQL port
 EXPOSE 5432