forked from wanghaisheng/fhirbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (34 loc) · 1.8 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM ubuntu:14.10
MAINTAINER Nicola <[email protected]>, BazZy <[email protected]>
RUN apt-get update && apt-get -y -q install git python-software-properties software-properties-common
RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8
RUN apt-get -y -q install postgresql-9.4 postgresql-client-9.4 postgresql-contrib-9.4 postgresql-9.4-plv8
ADD . /fhirbase
RUN chown -R postgres /fhirbase
USER postgres
RUN /etc/init.d/postgresql start \
&& psql --command "CREATE USER fhirbase WITH SUPERUSER PASSWORD 'fhirbase';" \
&& createdb -O fhirbase pgdb
RUN /etc/init.d/postgresql start && cd /fhirbase && DB=fhirbase ./runme integrate
USER root
# Adjust PostgreSQL configuration so that remote connections to the
# database are possible.
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.4/main/pg_hba.conf
# And add ``listen_addresses`` to ``/etc/postgresql/9.4/main/postgresql.conf``
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.4/main/postgresql.conf
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.4/main/pg_hba.conf
# Expose the PostgreSQL port
EXPOSE 5432
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
# Add VOLUMEs to allow backup of config, logs, socket and databases
VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql", "/var/run/postgresql"]
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
# Set the default command to run when starting the container
CMD ["/usr/lib/postgresql/9.4/bin/postgres", "-D", "/var/lib/postgresql/9.4/main", "-c", "config_file=/etc/postgresql/9.4/main/postgresql.conf"]