-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile-psql
More file actions
71 lines (58 loc) · 2.27 KB
/
Dockerfile-psql
File metadata and controls
71 lines (58 loc) · 2.27 KB
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
FROM maven:3.3.3-jdk-8
ENV CHATALYTICSPARENTDIR /opt/chatalytics
ENV CHATALYTICSDIR ${CHATALYTICSPARENTDIR}/chatalytics
ENV CHATALYTICSUIDIR ${CHATALYTICSPARENTDIR}/chatalyticsui
ENV DATABASEDIR /mnt/
ENV POSTGRESDIR /usr/lib/postgresql/9.5/bin/
# Install all the necessary packages
RUN apt-get update
RUN apt-get install -y software-properties-common\
python-software-properties\
apt-transport-https
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv 68576280
RUN apt-add-repository "deb https://deb.nodesource.com/node_5.x $(lsb_release -sc) main"
# add postgres repo
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add -
RUN apt-get update
RUN apt-get install -y nodejs
RUN apt-get install -y postgresql-9.5 postgresql-contrib-9.5
RUN mkdir -p ${CHATALYTICSDIR}
RUN mkdir -p ${DATABASEDIR}/chatalytics
# setup postgres
WORKDIR ${DATABASEDIR}
RUN chown -R postgres ${DATABASEDIR}chatalytics
ENV PATH $PATH:/usr/lib/postgresql/9.5/bin/
USER postgres
RUN initdb ${DATABASEDIR}chatalytics
RUN pg_ctl --pgdata ${DATABASEDIR}chatalytics --log ${DATABASEDIR}chatalytics/db-logfile -w start\
&& createuser chat_user\
&& createdb chatalytics
USER root
# Setup the stack
# Copy the source code
COPY OpenChatAlytics ${CHATALYTICSDIR}/code
COPY OpenChatAlyticsUI ${CHATALYTICSUIDIR}
# Setup the platform first
WORKDIR ${CHATALYTICSDIR}/code
RUN mvn clean package -Dmaven.test.skip=true
# Copy all the necessary things
RUN cp web/target/chatalytics-web-0.3-with-dependencies.jar ${CHATALYTICSDIR}
RUN cp compute/target/chatalytics-compute-0.3-with-dependencies.jar ${CHATALYTICSDIR}
RUN cp -r config ${CHATALYTICSDIR}
WORKDIR ${CHATALYTICSDIR}
RUN rm -rf code
RUN cp config/META-INF/persistence.psql.xml config/META-INF/persistence.xml
# Now setup the UI
WORKDIR ${CHATALYTICSUIDIR}
RUN rm -rf node_modules
RUN rm -rf client/dist
RUN npm install
RUN npm run dist
ARG NODE=production
ENV NODE_ENV ${NODE}
EXPOSE 3001
# Copy over the script and start it
WORKDIR ${CHATALYTICSPARENTDIR}
COPY OpenChatAlyticsStack/bin/start-web-compute-ui-psql.sh .
CMD ./start-web-compute-ui-psql.sh chatalytics-local.yaml