-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
123 lines (109 loc) · 2.9 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
FROM alpine:3.7
MAINTAINER Huang Rui <vowstar@gmail.com>, Turtle <turtled@emqtt.io>
ENV EMQ_VERSION=v2.3.9
COPY ./start.sh /start.sh
RUN set -ex \
# add build deps, remove after build
&& apk --no-cache add --virtual .build-deps \
build-base \
# gcc \
# make \
bsd-compat-headers \
perl \
erlang \
erlang-public-key \
erlang-syntax-tools \
erlang-erl-docgen \
#erlang-gs \
erlang-observer \
erlang-ssh \
#erlang-ose \
erlang-cosfiletransfer \
erlang-runtime-tools \
erlang-os-mon \
erlang-tools \
erlang-cosproperty \
erlang-common-test \
erlang-dialyzer \
erlang-edoc \
erlang-otp-mibs \
erlang-crypto \
erlang-costransaction \
erlang-odbc \
erlang-inets \
erlang-asn1 \
erlang-snmp \
erlang-erts \
erlang-et \
erlang-cosnotification \
erlang-xmerl \
#erlang-typer \
erlang-coseventdomain \
erlang-stdlib \
erlang-diameter \
erlang-hipe \
erlang-ic \
erlang-eunit \
#erlang-webtool \
erlang-mnesia \
erlang-erl-interface \
#erlang-test-server \
erlang-sasl \
erlang-jinterface \
erlang-kernel \
erlang-orber \
erlang-costime \
#erlang-percept \
erlang-dev \
erlang-eldap \
erlang-reltool \
erlang-debugger \
erlang-ssl \
erlang-megaco \
erlang-parsetools \
erlang-cosevent \
erlang-compiler \
# add fetch deps, remove after build
&& apk add --no-cache --virtual .fetch-deps \
git \
wget \
# add run deps, never remove
&& apk add --no-cache --virtual .run-deps \
ncurses-terminfo-base \
ncurses-terminfo \
ncurses-libs \
postgresql-client \
readline \
# add latest rebar
&& git clone -b ${EMQ_VERSION} https://github.com/emqtt/emq-relx.git /emqttd \
&& cd /emqttd \
&& make \
&& mkdir -p /opt && mv /emqttd/_rel/emqttd /opt/emqttd \
&& cd / && rm -rf /emqttd \
&& mv /start.sh /opt/emqttd/start.sh \
&& chmod +x /opt/emqttd/start.sh \
&& ln -s /opt/emqttd/bin/* /usr/local/bin/ \
# removing fetch deps and build deps
&& apk --purge del .build-deps .fetch-deps \
&& rm -rf /var/cache/apk/*
WORKDIR /opt/emqttd
# start emqttd and initial environments
CMD ["/opt/emqttd/start.sh"]
RUN adduser -D -u 1000 emqtt
RUN chgrp -Rf root /opt/emqttd && chmod -Rf g+w /opt/emqttd \
&& chown -Rf emqtt /opt/emqttd
USER emqtt
VOLUME ["/opt/emqttd/log", "/opt/emqttd/data", "/opt/emqttd/lib", "/opt/emqttd/etc", "/opt/emqttd"]
ADD ./start.sh /opt/emqttd/start.sh
ADD ./table.sql /opt/emqttd/table.sql
# start emqttd and initial environments
CMD ["/opt/emqttd/start.sh"]
# emqttd will occupy these port:
# - 1883 port for MQTT
# - 8883 port for MQTT(SSL)
# - 8083 for WebSocket/HTTP
# - 8084 for WSS/HTTPS
# - 18083 for dashboard
# - 4369 for port mapping
# - 6000-6999 for distributed node
EXPOSE 1883 8883 8083 8084 18083 4369 6000-6999