Skip to content

Commit 843921a

Browse files
committed
[docker] Changing to jessie, push gcc, plugins preinstall
1 parent de38678 commit 843921a

File tree

5 files changed

+25
-14
lines changed

5 files changed

+25
-14
lines changed

Dockerfile-api

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:8.16
1+
FROM node:8.16-jessie
22

33
ARG COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,enterpriseinfo,logger,systemlogs,errorlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,assistant,plugin-upload,times-of-day,compliance-hub,video-intelligence-monetization,alerts,onboarding
44
ARG COUNTLY_CONFIG_API_MONGODB_HOST=localhost
@@ -12,30 +12,34 @@ RUN chmod +x /tini
1212

1313
ENTRYPOINT ["/tini", "-v", "--"]
1414

15-
RUN apt-get update && apt-get -y install sendmail sqlite3 && \
15+
RUN apt-get update && apt-get -y install sendmail sqlite3 gcc-4.8 g++-4.8 && \
16+
export CXX="g++-4.8" && \
17+
export CC="gcc-4.8" && \
18+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 && \
1619
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1720

1821
# Required by push plugin
1922
RUN git clone https://github.com/nghttp2/nghttp2.git $DIR/nghttp2 && \
2023
cd $DIR/nghttp2 && \
2124
git checkout tags/v1.30.0 && \
22-
autoreconf -i && automake && autoconf && ./configure --disable-examples --disable-app && make && make install
25+
export CFLAGS="-g -O2 -fPIC" && export CPPFLAGS="-fPIC" && autoreconf -i && automake && autoconf && ./configure --disable-examples --disable-app && make && make install
2326

2427
# Setup Countly
25-
ENV COUNTLY_DOCKER 1
28+
ENV COUNTLY_CONTAINER="api"
2629
ENV COUNTLY_DEFAULT_PLUGINS="${COUNTLY_PLUGINS}"
2730

2831
## The files
2932
RUN mkdir /opt/countly && chown 1001:1001 /opt/countly
3033
USER 1001
3134
WORKDIR /opt/countly
3235
COPY --chown=1001 . .
33-
HEALTHCHECK --start-period=120s CMD curl --fail http://localhost:3001/ping || exit 1
36+
HEALTHCHECK --start-period=120s CMD curl --fail http://localhost:3001/o/ping || exit 1
3437

3538
## API runtime dependencies
3639
RUN cp -n api/config.sample.js api/config.js && \
3740
cp -n frontend/express/config.sample.js frontend/express/config.js && \
3841
HOME=/tmp npm install && \
42+
./bin/docker/preinstall.sh && \
3943
rm -rf /tmp/*
4044

41-
CMD ["/opt/countly/bin/docker/cmd.sh", "api"]
45+
CMD ["/opt/countly/bin/docker/cmd.sh"]

Dockerfile-frontend

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:8.16
1+
FROM node:8.16-jessie
22

33
ARG COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,enterpriseinfo,logger,systemlogs,errorlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,assistant,plugin-upload,times-of-day,compliance-hub,video-intelligence-monetization,alerts,onboarding
44
ARG COUNTLY_CONFIG_API_MONGODB_HOST=localhost
@@ -16,7 +16,7 @@ RUN apt-get update && apt-get -y install sendmail && \
1616
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1717

1818
# Setup Countly
19-
ENV COUNTLY_DOCKER 1
19+
ENV COUNTLY_CONTAINER="frontend"
2020
ENV COUNTLY_DEFAULT_PLUGINS="${COUNTLY_PLUGINS}"
2121

2222
## The files
@@ -30,6 +30,7 @@ RUN cp -n frontend/express/public/javascripts/countly/countly.config.sample.js f
3030
cp -n frontend/express/config.sample.js frontend/express/config.js && \
3131
cp -n api/config.sample.js api/config.js && \
3232
HOME=/tmp npm install && \
33+
./bin/docker/preinstall.sh && \
3334
rm -rf /tmp/*
3435

35-
CMD ["/opt/countly/bin/docker/cmd.sh", "frontend"]
36+
CMD ["/opt/countly/bin/docker/cmd.sh"]

bin/docker/cmd.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash
22

3-
CMD=$1
4-
53
if [ -f /opt/countly/plugins/plugins.json ]; then
64
echo "[docker] Plugins have been built, skipping rebuilding"
75
else
@@ -17,13 +15,12 @@ else
1715

1816
while read -r plugin; do
1917
echo "[docker] Installing ${plugin}:"
20-
(cd "/opt/countly/plugins/$plugin" && HOME=/tmp npm install)
2118
/usr/local/bin/node "/opt/countly/plugins/$plugin/install.js"
2219
echo "[docker] Done installing ${plugin}."
2320
done <<< "$a"
2421
fi
2522

26-
case "$CMD" in
23+
case "$COUNTLY_CONTAINER" in
2724
"api" )
2825
exec /usr/local/bin/node /opt/countly/api/api.js
2926
;;

bin/docker/preinstall.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -x #echo on
3+
4+
for plugin in `find /opt/countly/plugins -type d -mindepth 1 -maxdepth 1`
5+
do
6+
echo "Installing $plugin..."
7+
(cd "$plugin" && HOME=/tmp npm install)
8+
echo "done"
9+
done

plugins/push/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "Count.ly",
77
"homepage": "https://count.ly/plugins/rich-push-notifications",
88
"scripts": {
9-
"postinstall": "cd ./api/parts/apn && npm install"
9+
"postinstall": "[ \"${COUNTLY_CONTAINER}\" != \"frontend\" ] && cd ./api/parts/apn && npm install"
1010
},
1111
"repository": {
1212
"type": "git",

0 commit comments

Comments
 (0)