forked from altLab/liquid-feedback-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
158 lines (119 loc) · 3.65 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#
# Dockerfile for liquid-feedback
#
FROM debian:jessie
MAINTAINER Pedro Ângelo <[email protected]>
ENV LF_CORE_VERSION 3.2.1
ENV LF_FEND_VERSION 3.2.1
ENV LF_WMCP_VERSION 2.1.0
ENV LF_MOONBRIDGE_VERSION 1.0.1
#
# install dependencies
#
RUN apt-get update && apt-get -y install \
build-essential \
exim4 \
imagemagick \
liblua5.2-dev \
libpq-dev \
lua5.2 \
liblua5.2-0 \
mercurial \
postgresql \
postgresql-server-dev-9.4 \
python-pip \
pmake \
libbsd-dev \
curl \
&& pip install markdown2
#
# prepare file tree
#
RUN mkdir -p /opt/lf/sources/patches \
/opt/lf/sources/scripts \
/opt/lf/bin
WORKDIR /opt/lf/sources
#
# Download sources
#
RUN hg clone -r v${LF_CORE_VERSION} http://www.public-software-group.org/mercurial/liquid_feedback_core/ ./core \
&& hg clone -r v${LF_FEND_VERSION} http://www.public-software-group.org/mercurial/liquid_feedback_frontend/ ./frontend \
&& hg clone -r v${LF_WMCP_VERSION} http://www.public-software-group.org/mercurial/webmcp ./webmcp
RUN curl -o moonbridge.tar.gz http://www.public-software-group.org/pub/projects/moonbridge/v${LF_MOONBRIDGE_VERSION}/moonbridge-v${LF_MOONBRIDGE_VERSION}.tar.gz \
&& tar -xvf moonbridge.tar.gz
#
# Build moonbridge
#
RUN cd /opt/lf/sources/moonbridge-v${LF_MOONBRIDGE_VERSION} \
&& pmake MOONBR_LUA_PATH=/opt/lf/moonbridge/?.lua \
&& mkdir /opt/lf/moonbridge \
&& cp moonbridge /opt/lf/moonbridge/ \
&& cp moonbridge_http.lua /opt/lf/moonbridge/
#
# build core
#
WORKDIR /opt/lf/sources/core
RUN make \
&& cp lf_update lf_update_issue_order lf_update_suggestion_order /opt/lf/bin
#
# build WebMCP
#
# COPY ./patches/webmcp_build.patch /opt/lf/sources/patches/
WORKDIR /opt/lf/sources/webmcp
# RUN patch -p1 -i /opt/lf/sources/patches/webmcp_build.patch \
# && make \
# && mkdir /opt/lf/webmcp \
# && cp -RL framework/* /opt/lf/webmcp
RUN make \
&& mkdir /opt/lf/webmcp \
&& cp -RL framework/* /opt/lf/webmcp
WORKDIR /opt/lf/
RUN cd /opt/lf/sources/frontend \
&& hg archive -t files /opt/lf/frontend \
&& cd /opt/lf/frontend/fastpath \
&& make \
&& chown www-data /opt/lf/frontend/tmp
#
# setup db
#
COPY ./scripts/setup_db.sql /opt/lf/sources/scripts/
COPY ./scripts/config_db.sql /opt/lf/sources/scripts/
RUN addgroup --system lf \
&& adduser --system --ingroup lf --no-create-home --disabled-password lf \
&& service postgresql start \
&& (su -l postgres -c "psql -f /opt/lf/sources/scripts/setup_db.sql") \
&& (su -l postgres -c "PGPASSWORD=liquid psql -U liquid_feedback -h 127.0.0.1 -f /opt/lf/sources/core/core.sql liquid_feedback") \
&& (su -l postgres -c "PGPASSWORD=liquid psql -U liquid_feedback -h 127.0.0.1 -f /opt/lf/sources/scripts/config_db.sql liquid_feedback") \
&& service postgresql stop
#
# cleanup
#
RUN rm -rf /opt/lf/sources \
&& apt-get -y purge \
build-essential \
liblua5.2-dev \
libpq-dev \
mercurial \
postgresql-server-dev-9.4 \
python-pip \
&& apt-get -y autoremove \
&& apt-get clean
#
# configure everything
#
# TODO: configure mail system
# # webserver config
# COPY ./scripts/60-liquidfeedback.conf /etc/lighttpd/conf-available/
# RUN ln -s /etc/lighttpd/conf-available/60-liquidfeedback.conf /etc/lighttpd/conf-enabled/60-lighttpd.conf
# app config
COPY ./scripts/lfconfig.lua /opt/lf/frontend/config/
# update script
COPY ./scripts/lf_updated /opt/lf/bin/
# startup script
COPY ./scripts/start.sh /opt/lf/bin/
#
# ready to go
#
EXPOSE 8080
WORKDIR /opt/lf/frontend
ENTRYPOINT ["/opt/lf/bin/start.sh"]