-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDockerfile
141 lines (106 loc) · 3.38 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
#
# Dockerfile for liquid-feedback
#
FROM debian:buster
MAINTAINER Pedro Ângelo <[email protected]>
ENV LF_CORE_VERSION 3.2.1
ENV LF_FRONTEND_VERSION 3.2.1
ENV LF_WEBMCP_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 \
postgresql \
postgresql-server-dev-11 \
pmake \
libbsd-dev \
curl \
discount
#
# prepare file tree
#
RUN mkdir -p /opt/lf/sources/patches \
/opt/lf/sources/scripts \
/opt/lf/bin
WORKDIR /opt/lf/sources
#
# Download sources
#
RUN curl https://www.public-software-group.org/pub/projects/liquid_feedback/backend/v${LF_CORE_VERSION}/liquid_feedback_core-v${LF_CORE_VERSION}.tar.gz | tar -xvzf - \
&& curl https://www.public-software-group.org/pub/projects/liquid_feedback/frontend/v${LF_FRONTEND_VERSION}/liquid_feedback_frontend-v${LF_FRONTEND_VERSION}.tar.gz | tar -xvzf - \
&& curl https://www.public-software-group.org/pub/projects/webmcp/v${LF_WEBMCP_VERSION}/webmcp-v${LF_WEBMCP_VERSION}.tar.gz | tar -xvzf - \
&& curl https://www.public-software-group.org/pub/projects/moonbridge/v${LF_MOONBRIDGE_VERSION}/moonbridge-v${LF_MOONBRIDGE_VERSION}.tar.gz | tar -xvzf -
#
# 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/liquid_feedback_core-v${LF_CORE_VERSION}
RUN make \
&& cp lf_update lf_update_issue_order lf_update_suggestion_order /opt/lf/bin
#
# build WebMCP
#
WORKDIR /opt/lf/sources/webmcp-v${LF_WEBMCP_VERSION}
RUN make \
&& mkdir /opt/lf/webmcp \
&& cp -RL framework/* /opt/lf/webmcp
WORKDIR /opt/lf/
RUN cd /opt/lf/sources/liquid_feedback_frontend-v${LF_FRONTEND_VERSION} \
&& cp -R . /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/liquid_feedback_core-v${LF_CORE_VERSION}/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 \
postgresql-server-dev-11 \
&& apt-get -y autoremove \
&& apt-get clean
#
# configure everything
#
# TODO: configure mail system
# 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"]