forked from Countly/countly-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-core
86 lines (78 loc) · 4.72 KB
/
Dockerfile-core
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
FROM phusion/baseimage:0.10.2
ARG COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,enterpriseinfo,logger,systemlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,assistant,times-of-day,compliance-hub,video-intelligence-monetization,alerts,onboarding
# Enterprise Edition:
#ARG COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,drill,funnels,concurrent_users,retention_segments,revenue,logger,systemlogs,populator,reports,crashes,push,block,restrict,users,geo,star-rating,slipping-away-users,compare,server-stats,dashboards,assistant,flows,dbviewer,cohorts,crash_symbolication,crashes-jira,groups,white-labeling,alerts,times-of-day,compliance-hub,onboarding,remote-config,formulas,ab-testing
ARG COUNTLY_CONFIG_API_MONGODB_HOST=localhost
ARG COUNTLY_CONFIG_FRONTEND_MONGODB_HOST=localhost
CMD ["/sbin/my_init"]
## Setup Countly
ENV COUNTLY_CONTAINER="both" \
COUNTLY_DEFAULT_PLUGINS="${COUNTLY_PLUGINS}" \
COUNTLY_CONFIG_API_API_HOST="0.0.0.0" \
COUNTLY_CONFIG_FRONTEND_WEB_HOST="0.0.0.0"
EXPOSE 80
USER root
WORKDIR /opt/countly
COPY . .
RUN useradd -r -M -U -d /opt/countly -s /bin/false countly && \
apt-get update && \
apt-get -y install \
# standard
build-essential libkrb5-dev git sqlite3 wget sudo \
# nginx
nginx \
# puppeteer
gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 \
libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 \
libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils \
# push / nghttp2
gcc-4.8 g++-4.8 make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev \
libevent-dev libjansson-dev libjemalloc-dev cython python3-dev python-setuptools && \
# node
wget -qO- https://deb.nodesource.com/setup_8.x | bash - && \
# data_migration (mongo clients)
wget -qO - https://www.mongodb.org/static/pgp/server-3.6.asc | apt-key add - && \
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.6.list && \
apt-get update && \
apt-get -y install nodejs mongodb-org-shell mongodb-org-tools && \
\
# nghttp2
(export CXX="g++-4.8" && export CC="gcc-4.8" && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 && \
git clone https://github.com/nghttp2/nghttp2.git /tmp/nghttp2 --single-branch --branch=v1.30.0 --depth=1 && \
cd /tmp/nghttp2 && \
export CFLAGS="-g -O2 -fPIC" && export CPPFLAGS="-fPIC" && autoreconf -i && automake && autoconf && \
./configure --disable-examples --disable-app && make && make install && export CC="" && export CXX="") && \
\
# configs
cp ./bin/config/nginx.server.conf /etc/nginx/sites-enabled/default && \
cp ./bin/config/nginx.conf /etc/nginx/nginx.conf && \
cp ./api/config.sample.js ./api/config.js && \
cp ./frontend/express/config.sample.js ./frontend/express/config.js && \
cp ./frontend/express/public/javascripts/countly/countly.config.sample.js ./frontend/express/public/javascripts/countly/countly.config.js && \
\
# npm dependencies
./bin/docker/modify.sh && \
HOME=/tmp npm install --unsafe-perm && \
./bin/docker/preinstall.sh && \
\
# web sdk
bash ./bin/scripts/detect.init.sh && \
countly update sdk-web && \
\
# services and such
mkdir -p /etc/my_init.d && cp ./bin/docker/postinstall.sh /etc/my_init.d/ && \
mkdir /etc/service/nginx && \
mkdir /etc/service/countly-api && \
mkdir /etc/service/countly-dashboard && \
echo "" >> /etc/nginx/nginx.conf && \
echo "daemon off;" >> /etc/nginx/nginx.conf && \
cp ./bin/commands/docker/nginx.sh /etc/service/nginx/run && \
cp ./bin/commands/docker/countly-api.sh /etc/service/countly-api/run && \
cp ./bin/commands/docker/countly-dashboard.sh /etc/service/countly-dashboard/run && \
chown -R countly:countly /opt/countly && \
# cleanup
apt-get -y remove build-essential libkrb5-dev git sqlite3 wget \
gcc-4.8 g++-4.8 gcc g++ make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev libjemalloc-dev cython python3-dev python-setuptools && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /tmp/.??* /var/tmp/* /var/tmp/.??* ~/.npm
# USER 1001:0