-
Notifications
You must be signed in to change notification settings - Fork 39
/
Dockerfile-pg-9.4-plv8-1.4.4
94 lines (71 loc) · 3.33 KB
/
Dockerfile-pg-9.4-plv8-1.4.4
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
FROM ubuntu:14.04.4
MAINTAINER Danil Kutkevich <[email protected]>
ENV REFRESHED_AT 20160418T0800Z
RUN localedef --force --inputfile=en_US --charmap=UTF-8 \
--alias-file=/usr/share/locale/locale.alias \
en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt-get --yes update
# RUN apt-get --yes upgrade
# Add PostgreSQL (9.1, 9.2, 9.3, 9.4, 9.5) apt repository
# <http://www.postgresql.org/download/linux/ubuntu/>.
RUN apt-get install --yes curl
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' \
> /etc/apt/sources.list.d/pgdg.list
RUN curl --silent https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
sudo apt-key add -
RUN apt-get --yes update
# RUN apt-get --yes upgrade
# Install PostgreSQL.
ENV PG_MAJOR 9.4
RUN apt-get install --yes postgresql-$PG_MAJOR
# Install plv8 (in case of plv8 compilation issues address to
# README in <https://github.com/clkao/docker-postgres-plv8>).
RUN apt-get install --yes git build-essential libv8-dev postgresql-server-dev-$PG_MAJOR
RUN apt-get install --yes nodejs-dev
# 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/$PG_MAJOR/main/pg_hba.conf
RUN echo 'local all all trust' >> /etc/postgresql/$PG_MAJOR/main/pg_hba.conf
RUN echo "listen_addresses='*'" >> /etc/postgresql/$PG_MAJOR/main/postgresql.conf
USER postgres
# Fix PostgreSQL locale
# <http://stackoverflow.com/questions/16736891/pgerror-error-new-encoding-utf8-is-incompatible#16737776>,
# <http://www.postgresql.org/message-id/[email protected]>,
# <http://www.postgresql.org/docs/current/static/multibyte.html#AEN35730>.
RUN service postgresql start \
&& psql --command="UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';" \
&& psql --command="DROP DATABASE template1;" \
&& psql --command="CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8';" \
&& psql --command="UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';" \
&& psql --command="CREATE ROLE fhirbase WITH SUPERUSER LOGIN PASSWORD 'fhirbase';" \
&& psql --command="CREATE DATABASE fhirbase WITH OWNER fhirbase ENCODING = 'UTF8';"
USER root
RUN useradd --user-group --create-home --shell /bin/bash fhirbase \
&& echo 'fhirbase:fhirbase' | chpasswd && adduser fhirbase sudo
RUN echo 'fhirbase ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
COPY . /home/fhirbase/fhirbase
RUN chown -R fhirbase:fhirbase /home/fhirbase/fhirbase
USER fhirbase
# Install nodejs.
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh \
| bash
RUN bash -lc 'source ~/.nvm/nvm.sh && nvm install 6.2.0'
RUN bash -lc 'cd ~/fhirbase && source ~/.nvm/nvm.sh && nvm use 6.2.0 \
&& npm install'
RUN bash -lc 'cd ~/fhirbase/plpl && source ~/.nvm/nvm.sh && nvm use 6.2.0 \
&& npm install'
USER root
ENV PLV8_VERSION v1.4.4
RUN cd /tmp \
&& git clone https://github.com/plv8/plv8.git \
&& cd /tmp/plv8 \
&& git checkout $PLV8_VERSION \
&& make all install
COPY docker-run-tests.sh /
RUN chmod a+rwx /docker-run-tests.sh
RUN chown fhirbase /docker-run-tests.sh
USER fhirbase
# Install fhirbase and run test suite.
ENTRYPOINT ["/docker-run-tests.sh"]
# CMD ["--schemas='public'"]