-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile
32 lines (23 loc) · 1.16 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
FROM postgres:9.4.1
MAINTAINER Nikolay Ryzhikov <[email protected]>, Mike Lapshin <[email protected]>, Maksym Bodnarchuk <[email protected]>
RUN apt-get -qq update
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
RUN apt-get -qqy install python sudo
ENV PGDATA /data
RUN mkdir -p $PGDATA && chown postgres -R $PGDATA
RUN gosu postgres initdb -D $PGDATA -E utf8
RUN echo 'postgres ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
ENV PGDATABASE fhirbase
ADD . /fhirbase
RUN cp ./fhirbase/docker/fb-generate /usr/bin
RUN chmod +x /usr/bin/fb-generate
RUN chown -R postgres /fhirbase
RUN mkdir -p /home/postgres
RUN chown -R postgres /home/postgres
USER postgres
RUN pg_ctl -w start && cd /fhirbase && psql -d postgres -c "create database $PGDATABASE" && env DB=$PGDATABASE ./runme integrate && pg_ctl -w stop
RUN pg_ctl -w start && createuser -s fhirbase && psql -c "alter user fhirbase with password 'fhirbase'; select fhir.generate_tables(); select fhir.index_all_resources()" && pg_ctl -w stop
RUN echo "host all all 0.0.0.0/0 md5" >> $PGDATA/pg_hba.conf
RUN echo "listen_addresses='*'" >> $PGDATA/postgresql.conf
EXPOSE 5432
CMD fb-generate && postgres